forked from asyncapi/spec
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (59 loc) · 2.29 KB
/
update-spec.yaml
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
name: Update latest specification document in the website
on:
push:
branches:
- 'master'
paths:
- 'spec/asyncapi.md'
jobs:
Make-PR:
name: Make PR on website repository with updated latest spec
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout Current repository
uses: actions/checkout@v3
with:
path: spec
- name: Checkout Another repository
uses: actions/checkout@v3
with:
repository: asyncapi/website
path: website
token: ${{ env.GITHUB_TOKEN }}
- name: Config git
run: |
git config --global user.name asyncapi-bot
git config --global user.email [email protected]
- name: Get latest release
id: latest_version
uses: abatilo/release-info-action@5774bec4e3eabad433b4ae8f625e83afa0e7bb22 # 1.3.2 release https://github.com/abatilo/release-info-action/releases/tag/v1.3.2
with:
owner: asyncapi
repo: spec
- name: Create branch
working-directory: ./website
run: |
git checkout -b update-spec-${{ steps.latest_version.outputs.latest_tag }}
- name: Copy Spec file from Current Repo to Another
working-directory: ./website
run: |
cp ../spec/spec/asyncapi.md ./pages/docs/reference/specification/${{ steps.latest_version.outputs.latest_tag }}.md
- name: Remove Table of Contents from Spec
uses: actions/github-script@v6
with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const script = require('./spec/.github/scripts/remove-toc');
script(`${{ steps.latest_version.outputs.latest_tag }}`);
- name: Commit and push
working-directory: ./website
run: |
git add .
git commit -m "docs(spec): update latest specification"
git push https://${{ env.GITHUB_TOKEN }}@github.com/asyncapi/website
- name: Create PR
working-directory: ./website
run: |
gh pr create --title "docs(spec): update latest specification" --body "Updated specification is available and this PR introduces update to specification document on the website" --head "update-spec-${{ steps.latest_version.outputs.latest_tag }}"