-
Notifications
You must be signed in to change notification settings - Fork 61
63 lines (61 loc) · 1.91 KB
/
deploy.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
name: Deploy
on:
push:
branches:
- "main"
jobs:
setup:
runs-on: ubuntu-latest
outputs:
releases: ${{ steps.releases.outputs.releases }}
steps:
- id: releases
run: |
echo "releases=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/${{github.repository}}/releases?per_page=100" | jq -c '[.[].tag_name]')" >> $GITHUB_OUTPUT
releases:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
release: ${{fromJson(needs.setup.outputs.releases)}}
steps:
- uses: dsaltares/fetch-gh-release-asset@1.1.0
with:
version: 'tags/${{ matrix.release }}'
file: 'builder-oapi.json'
target: 'deploy/releases/${{ matrix.release }}/builder-oapi.json'
- name: Save releases (artifact)
uses: actions/upload-artifact@v3
with:
name: releases
retention-days: 7
path: |
deploy/releases
deploy:
needs: releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v2
- run: npm i -g @apidevtools/swagger-cli@4
- name: Prepare deploy directory
run: |
mkdir ./deploy
cp -r dist ./deploy
cp -r assets ./deploy
cp index.html ./deploy
- name: Restore releases
uses: actions/download-artifact@v3
with:
name: releases
path: deploy/releases
- name: Bundle spec
run: "swagger-cli bundle ./builder-oapi.yaml -r -t yaml -o ./deploy/builder-oapi.yaml"
- name: Publish to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
publish_branch: gh-pages