-
Notifications
You must be signed in to change notification settings - Fork 43
50 lines (41 loc) · 1.6 KB
/
dispatch-update.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
name: Update Docs Version
on:
repository_dispatch:
types: [update-version]
jobs:
update-docs-version:
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v3
- name: Extract tag name
run: echo "TAG_NAME=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV
- name: Update docs to new version
run: |
TAG_NAME="$(echo "${TAG_NAME}" | sed 's/^v//')"
# Update docs to use the new version
sed -i -E "s/v\.?[0-9]+\.[0-9]+\.[0-9]+[a-zA-Z0-9\-]*/v${TAG_NAME}/g" \
docs/advanced/quickstart-split.md \
docs/advanced/test-command.md \
docs/advanced/quickstart-combine.md \
docs/charon/charon-cli-reference.md \
docs/faq/errors.mdx \
docs/start/quickstart_group.mdx \
docs/start/quickstart_alone.mdx
#install dependencies
yarn
# Update version with yarn
yarn run version v${TAG_NAME}
# Commit and push changes
git checkout -b update-version-${{ env.TAG_NAME }}
git add .
git commit -m "Update docs to use version v${TAG_NAME}"
git push origin update-version-${{ env.TAG_NAME }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: main
head: update-version-${{ env.TAG_NAME }}
title: "Update docs to use version v${TAG_NAME}"
body: "Automatically generated PR to update documentation for version v${TAG_NAME}"