deploy: update posts #239
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 | |
| run-name: "deploy: ${{ github.event_name == 'repository_dispatch' && github.event.action || 'update site' }}" | |
| on: | |
| repository_dispatch: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Checkout posts repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: posts-repo | |
| repository: theTeamFuture/posts | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Checkout time capsule repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: time-capsules-repo | |
| repository: theTeamFuture/time-capsules | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Setup PNPM | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/Jod | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build Astro | |
| run: | | |
| export SITE_REDIRECTS=$(cat posts-repo/redirect.json) | |
| pnpm run build | |
| - name: Create artifact | |
| run: | | |
| tar \ | |
| --dereference --hard-dereference \ | |
| --directory dist \ | |
| -cvf "$RUNNER_TEMP/artifact.tar" \ | |
| --force-local \ | |
| "." \ | |
| >/dev/null 2>&1 | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: github-pages | |
| path: ${{ runner.temp }}/artifact.tar | |
| retention-days: 1 | |
| if-no-files-found: error | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| pages: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Clean up artifacts | |
| if: always() | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: github-pages |