Skip to content

Update actions/upload|download-artifact from v3 to v4 (#82) #48

Update actions/upload|download-artifact from v3 to v4 (#82)

Update actions/upload|download-artifact from v3 to v4 (#82) #48

Workflow file for this run

name: Deploy
on:
push:
branches:
- "master"
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.2
with:
version: "tags/${{ matrix.release }}"
file: "keymanager-oapi.json"
target: "deploy/releases/${{ matrix.release }}/keymanager-oapi.json"
- name: Save releases (artifact)
uses: actions/upload-artifact@v4
with:
name: releases-${{ matrix.release }}
retention-days: 7
path: |
deploy/releases
deploy:
needs: releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- 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@v4
with:
path: deploy/releases
pattern: releases-*
merge-multiple: true
- name: Bundle spec
run: "swagger-cli bundle ./keymanager-oapi.yaml -r -t yaml -o ./deploy/keymanager-oapi.yaml"
- name: Publish to Github Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
publish_branch: gh-pages