-
Notifications
You must be signed in to change notification settings - Fork 85
54 lines (47 loc) · 1.89 KB
/
updateVersion.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
name: Update WasabiDoc Version
on:
repository_dispatch:
types: [update-version]
permissions:
contents: write
jobs:
update-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Update config.ts
run: |
NEW_VERSION="${{ github.event.client_payload.new_version }}"
echo "Updating to version: $NEW_VERSION"
sed -i "s/currentVersion: '[^']*'/currentVersion: '$NEW_VERSION'/" docs/.vuepress/config.ts
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "turbolay"
git checkout -b update-version-branch
git add docs/.vuepress/config.ts
git commit -m "Update version to ${{ github.event.client_payload.new_version }}"
git push -f --set-upstream origin update-version-branch
env:
GITHUB_TOKEN: ${{ secrets.VERSION_UPDATE_TOKEN }}
- name: Install GitHub CLI
run: sudo apt-get install gh
- name: Create Pull Request
run: |
gh pr create --base master --head update-version-branch --title "Update version to ${{ github.event.client_payload.new_version }}" --body "Auto-update version to ${{ github.event.client_payload.new_version }}."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Merge Pull Request with Admin Privileges
run: |
gh pr merge update-version-branch --admin --squash --delete-branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger Deployment
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/dispatches \
-d '{"event_type":"deploy-to-pages"}'