Deploy Docusaurus to GitHub Pages #48
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: Deploy Docusaurus to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- docs/** | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
deployments: write | |
jobs: | |
setup-nms: | |
name: Setup NMS | |
uses: "./.github/workflows/build-nms.yml" | |
secrets: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
needs: setup-nms | |
runs-on: ubuntu-latest | |
steps: | |
- name: Restore NMS cache | |
uses: actions/cache@v4 | |
with: | |
path: nms-build/.m2 | |
key: nms-maven | |
restore-keys: nms-maven | |
- name: Deploy NMS cache | |
run: | | |
ls nms-build/.m2/repository | |
ls nms-build/.m2/repository/repository | |
mv -f nms-build/.m2/repository $HOME/.m2/ -v | |
- uses: actions/checkout@v4 | |
- run: chmod -R +x docs/ | |
- uses: chrnorm/deployment-action@v2 | |
name: Create GitHub Deployment | |
id: deploy-status | |
with: | |
token: ${{ github.token }} | |
environment-url: https://scenamatica.kunlab.org | |
environment: production | |
initial-status: in_progress | |
- name: pnpm-setup | |
uses: pnpm/action-setup@v3 | |
with: | |
package_json_file: docs/package.json | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
id: maven-cache | |
with: | |
java-version: 17 | |
distribution: zulu | |
cache: maven | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v5 | |
with: | |
maven-version: 3.8.2 | |
- name: Install dependencies | |
run: | | |
cd docs | |
pnpm install | |
cd .. | |
- name: Build | |
run: | | |
cd docs | |
pnpm run build | |
cd .. | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "docs/build/" | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 | |
- name: Update GitHub Deployment | |
if: success() | |
uses: chrnorm/deployment-status@v2 | |
with: | |
token: ${{ github.token }} | |
deployment-id: ${{ steps.deploy-status.outputs.deployment_id }} | |
state: success | |
environment-url: https://scenamatica.kunlab.org | |
environment: production | |
- name: Update GitHub Deployment | |
if: failure() | |
uses: chrnorm/deployment-status@v2 | |
with: | |
token: ${{ github.token }} | |
deployment-id: ${{ steps.deploy-status.outputs.deployment_id }} | |
state: failure | |
environment-url: https://scenamatica.kunlab.org | |
- name: Update GitHub Deployment | |
if: cancelled() | |
uses: chrnorm/deployment-status@v2 | |
with: | |
token: ${{ github.token }} | |
deployment-id: ${{ steps.deploy-status.outputs.deployment_id }} | |
state: cancelled | |
environment-url: https://scenamatica.kunlab.org |