Docs #479
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: Docs | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- ".github/workflows/docs.yaml" | |
- "Writerside/**" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
id-token: write | |
pages: write | |
actions: write | |
env: | |
INSTANCE: Writerside/cetech1 | |
ARTIFACT: webHelpCETECH12-all.zip | |
DOCKER_VERSION: "243.22562" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Pull LFS | |
run: git lfs pull --include "Writerside/**/*" | |
- name: Build Writerside docs using Docker | |
uses: JetBrains/writerside-github-action@v4 | |
with: | |
instance: ${{ env.INSTANCE }} | |
artifact: ${{ env.ARTIFACT }} | |
docker-version: ${{ env.DOCKER_VERSION }} | |
- name: Save docs to cache | |
uses: actions/cache@v3 | |
with: | |
key: docs-cache-${{ github.sha }} | |
path: | | |
artifacts/${{ env.ARTIFACT }} | |
artifacts/report.json | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download docs | |
uses: actions/cache@v3 | |
with: | |
key: docs-cache-${{ github.sha }} | |
path: | | |
artifacts/${{ env.ARTIFACT }} | |
artifacts/report.json | |
fail-on-cache-miss: true | |
- name: Test documentation | |
uses: JetBrains/writerside-checker-action@v1 | |
with: | |
instance: ${{ env.INSTANCE }} | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download docs | |
uses: actions/cache@v3 | |
with: | |
key: docs-cache-${{ github.sha }} | |
path: | | |
artifacts/${{ env.ARTIFACT }} | |
artifacts/report.json | |
fail-on-cache-miss: true | |
- name: Unzip artifact | |
uses: montudor/action-zip@v1 | |
with: | |
args: unzip -qq artifacts/${{ env.ARTIFACT }} -d dir | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: dir | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
cleanup: | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
if: ${{ always() }} | |
needs: [build, test, deploy] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Cleanup | |
run: | | |
gh extension install actions/gh-actions-cache | |
REPO=${{ github.repository }} | |
## Setting this to not fail the workflow while deleting cache keys. | |
set +e | |
echo "Deleting caches..." | |
gh actions-cache delete docs-cache-${{ github.sha }} -R $REPO --confirm | |
echo "Done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |