[U] Update photo carousel #113
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: GitHub Pages (Branch Invoked) | |
| # To see the workflow clearer, I try to deploy first to a branch and then publish it. | |
| on: | |
| push: | |
| branches: | |
| - main # Set a branch to deploy | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| deployments: write | |
| concurrency: | |
| group: "pages-${{ github.ref }}" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v31 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Magic Nix Cache | |
| uses: DeterminateSystems/magic-nix-cache-action@v13 | |
| with: | |
| use-flakehub: false | |
| diagnostic-endpoint: "" | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(nix develop --command pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: nix develop --command pnpm install --frozen-lockfile | |
| - name: Build page | |
| run: nix develop --command pnpm docs:build | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: site-preview | |
| path: content/.vitepress/dist | |
| retention-days: 1 | |
| deploy: | |
| needs: build | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: https://oneamongus.ca | |
| steps: | |
| - name: Download Build Artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: site-preview | |
| path: content/.vitepress/dist | |
| - name: Deploy | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./content/.vitepress/dist | |
| publish_branch: deploy | |
| cname: oneamongus.ca | |
| destination_dir: ./. |