From 1d48ca675d534455ce92a8817edac0ce5daa7733 Mon Sep 17 00:00:00 2001 From: Daniel N <2color@users.noreply.github.com> Date: Wed, 19 Feb 2025 11:10:08 +0100 Subject: [PATCH] feat: deploy static site to gh pages --- .github/workflows/build.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0ff502..248d498 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,9 @@ on: branches: - main +env: + BUILD_PATH: 'out' + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true # Cancel in progress runs if a new run is started @@ -39,17 +42,17 @@ jobs: - name: Build project run: npm run build - - name: Upload build artifacts - uses: actions/upload-artifact@v4 + - name: Upload static files as artifact + id: upload-artifact + uses: actions/upload-pages-artifact@v3 with: - name: build-output - path: out + path: ${{ env.BUILD_PATH }} - uses: ipfs/ipfs-deploy-action@v0.3 name: Deploy to IPFS id: deploy with: - path-to-deploy: out + path-to-deploy: ${{ env.BUILD_PATH }} storacha-key: ${{ secrets.STORACHA_KEY }} storacha-proof: ${{ secrets.STORACHA_PROOF }} pinata-jwt-token: ${{ secrets.PINATA_JWT_TOKEN }} @@ -88,3 +91,18 @@ jobs: ZONE_ID: ${{ secrets.CF_IPNS_NETWORK_ZONE_ID }} RECORD_ID: ${{ secrets.CF_IPNS_NETWORK_RECORD_ID }} AUTH_TOKEN: ${{ secrets.CF_IPNS_NETWORK_AUTH_TOKEN }} + + gh-pages: + runs-on: 'ubuntu-latest' + needs: build-and-deploy + if: github.ref == 'refs/heads/main' # only deploy to gh-pages for main branch + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + environment: + name: 'gh-pages' + url: ${{ steps.gh-pages.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4