Skip to content

Merge pull request #150 from ZeitOnline/ZO-6629 #82

Merge pull request #150 from ZeitOnline/ZO-6629

Merge pull request #150 from ZeitOnline/ZO-6629 #82

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 }}"}'