Deploy static content to Pages #430
This file contains hidden or 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 static content to Pages | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review, labeled] | |
| push: | |
| branches: | |
| - main | |
| # Allows manual triggering of the workflow in the Actions tab | |
| workflow_dispatch: | |
| inputs: | |
| skip_deploy: | |
| description: "If deploy job should skipped" | |
| required: false | |
| default: "" | |
| docs_tag: | |
| description: "Tag to recover docs from" | |
| required: false | |
| default: "" | |
| docs_repository: | |
| description: "Repository to recover docs from" | |
| required: false | |
| default: "" | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Install doxygen | |
| run: sudo apt install -y doxygen | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Restore cache | |
| id: cache-npm | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: "~/.npm" | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| - name: Install Dependencies | |
| run: npm install --no-fund --no-audit --loglevel verbose | |
| - name: Update docs | |
| run: > | |
| npm run update-doc | |
| ${{ github.event.inputs.docs_tag == '' && 'master' || github.event.inputs.docs_tag }} | |
| https://github.com/${{ github.event.inputs.docs_repository == '' && 'f3d-app/f3d' || github.event.inputs.docs_repository }} | |
| - name: Build | |
| run: npm run build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: "./build" | |
| - name: Save cache | |
| if: steps.cache-npm.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| key: ${{ steps.cache-npm.outputs.cache-primary-key }} | |
| path: "~/.npm" | |
| # Single deploy job since we're just deploying | |
| deploy: | |
| if: | | |
| github.ref == 'refs/heads/main' && | |
| github.event.inputs.skip_deploy != 'true' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |