-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (59 loc) · 1.97 KB
/
release-api-docs.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
62
63
64
65
66
67
68
69
70
71
name: Release api docs
on:
push:
branches:
- main
paths:
- 'docs/api/**'
- '.github/workflows/release-api-docs.yaml'
jobs:
release:
name: Release Swagger
runs-on: zon-ubuntu-general-dind
if: contains(github.repository, 'ZeitOnline')
env:
RELEASE_TAG: api-docs-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Cache dependencies
id: cache
uses: actions/cache@v2
with:
path: ./docs/api/node_modules
key: modules-${{ hashFiles('docs/api/package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd docs/api
npm ci --ignore-scripts
- name: Pack artifacts
run: tar -czf swagger-api-docs.tar.gz -C docs/api api.yaml swagger.html node_modules/swagger-ui-dist
- name: Update release tag
run: |
git fetch origin +refs/tags/${{ env.RELEASE_TAG}}:refs/tags/${{ env.RELEASE_TAG }}
git tag -d ${{ env.RELEASE_TAG }}
git push origin :refs/tags/${{ env.RELEASE_TAG }}
git tag -f ${{ env.RELEASE_TAG }}
git push origin ${{ env.RELEASE_TAG }}
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_TAG }}
files: swagger-api-docs.tar.gz
trigger:
name: Trigger main docs build
runs-on: zon-ubuntu-general-dind
if: contains(github.repository, 'ZeitOnline')
needs: release
steps:
- name: Trigger Repository Dispatch in docs
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PRIVATE_REPO_ACCESS_PAT }}
repository: ZeitOnline/docs
event-type: module-commit
client-payload: '{"repo": "${{ github.repository }}", "ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'