Deploy to GitHub Pages #56
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 to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| sha: | |
| description: 'Commit SHA to deploy (defaults to branch tip)' | |
| required: false | |
| type: string | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.sha || github.sha }} | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Compute base href | |
| id: base-href | |
| run: | | |
| if [ "${{ github.event.repository.name }}" = "${{ github.repository_owner }}.github.io" ]; then | |
| echo "value=/" >> $GITHUB_OUTPUT | |
| else | |
| echo "value=/${{ github.event.repository.name }}/" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build | |
| run: npm run build -- --base-href="${{ steps.base-href.outputs.value }}" | |
| - name: Deploy | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: gh-pages | |
| folder: dist/pythoncatania/browser |