-
Notifications
You must be signed in to change notification settings - Fork 70
65 lines (48 loc) · 2.09 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
name: Update Documentation
on:
release:
types: [published]
jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get the latest published NPM version
id: get_version
run: echo "LATEST_VERSION=$(npm show @wormhole-foundation/sdk version)" >> $GITHUB_ENV
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install the latest published SDK version
run: npm install @wormhole-foundation/sdk@$LATEST_VERSION --save-exact
- name: Update package.json version to match NPM release
run: |
jq --arg ver "$LATEST_VERSION" '.version=$ver' package.json > package.tmp.json && mv package.tmp.json package.json
- name: Install other dependencies
run: npm ci
- name: Generate documentation
run: npm run docs
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b update-docs-${{ env.LATEST_VERSION }}
echo "Checking Git Status Before Adding Files:"
git status
git restore package.json package-lock.json
echo "Checking Git Status After Reset:"
git status
git add docs/
git commit -m "Automated documentation update for SDK version $LATEST_VERSION" || exit 0
git push origin update-docs-${{ env.LATEST_VERSION }}
- name: Create a pull request using GitHub CLI
run: |
gh pr create --title "Automated Documentation Update for SDK version ${{ env.LATEST_VERSION }}" \
--body "This PR updates the documentation to match the latest SDK release: **${{ env.LATEST_VERSION }}**." \
--base main \
--head update-docs-${{ env.LATEST_VERSION }} \
--label "automated,documentation"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}