1.28.0 #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update docs | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: Branch or tag | |
required: true | |
default: master | |
jobs: | |
update-docs: | |
name: Update docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Nethermind repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.ref || github.ref }} | |
path: n | |
- name: Authenticate App | |
id: gh-app | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ vars.APP_ID }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
repositories: "nethermind,docs" | |
- name: Check out Nethermind docs repository | |
uses: actions/checkout@v4 | |
with: | |
repository: NethermindEth/docs | |
path: d | |
token: ${{ steps.gh-app.outputs.token }} | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
global-json-file: n/global.json | |
- name: Build DocGen | |
working-directory: n | |
run: dotnet build tools/docgen/DocGen.csproj -c release -o docgen | |
- name: Generate docs | |
run: | | |
mv d/docs/fundamentals/configuration.md n/docgen/configuration.md | |
mv d/docs/interacting/json-rpc-ns/eth_subscribe.md n/docgen/eth_subscribe.md | |
mv d/docs/interacting/json-rpc-ns/eth_unsubscribe.md n/docgen/eth_unsubscribe.md | |
mv d/docs/monitoring/metrics/metrics.md n/docgen/metrics.md | |
cd n/docgen | |
./DocGen --config --jsonrpc --metrics | |
cd ../.. | |
mv n/docgen/configuration.md d/docs/fundamentals/configuration.md | |
rm -f d/docs/interacting/json-rpc-ns/*.md | |
mv n/docgen/eth_subscribe.md d/docs/interacting/json-rpc-ns/eth_subscribe.md | |
mv n/docgen/eth_unsubscribe.md d/docs/interacting/json-rpc-ns/eth_unsubscribe.md | |
mv n/docgen/json-rpc-ns/*.md d/docs/interacting/json-rpc-ns | |
mv n/docgen/metrics.md d/docs/monitoring/metrics/metrics.md | |
- name: Tag a new version | |
if: github.event_name == 'release' && !github.event.release.prerelease | |
working-directory: d | |
run: | | |
npm i | |
npm run docusaurus docs:version v${{ github.event.release.tag_name }} | |
- name: Create a pull request | |
working-directory: d | |
env: | |
GH_TOKEN: ${{ steps.gh-app.outputs.token }} | |
run: | | |
version="${{ github.event_name == 'release' && format(' of v{0}', github.event.release.tag_name) || '' }}" | |
head_branch=feature/auto-update-${{ github.run_number }}-${{ github.run_attempt }} | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git checkout -b $head_branch | |
git add -A | |
git commit -am "Auto-update docs" | |
git push origin $head_branch | |
gh pr create -B main -H $head_branch -t "Auto-update docs" \ | |
-b "Autogenerated docs on \`${{ github.event_name }}\` event${version}." -l docgen |