forked from NethermindEth/nethermind
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (76 loc) · 3.02 KB
/
update-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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