Merge pull request #158 from ZeitOnline/maint/gha #88
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: '14' | |
- name: Cache dependencies | |
id: cache | |
uses: actions/[email protected] | |
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/[email protected] | |
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/[email protected] | |
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 }}"}' |