From 28f0e3dfbdf360c799017b78e601dd99318f1526 Mon Sep 17 00:00:00 2001 From: Tom Kuson Date: Sat, 14 Dec 2024 16:56:09 +0000 Subject: [PATCH] Attempt to build the site on PRs --- .../{deploy.yaml => build_and_deploy.yaml} | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) rename .github/workflows/{deploy.yaml => build_and_deploy.yaml} (64%) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/build_and_deploy.yaml similarity index 64% rename from .github/workflows/deploy.yaml rename to .github/workflows/build_and_deploy.yaml index 6d5592c..149593b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/build_and_deploy.yaml @@ -1,9 +1,10 @@ -name: Deploy static content to GitHub Pages +name: Build and Deploy on: push: branches: - main + pull_request: workflow_dispatch: permissions: @@ -16,10 +17,7 @@ concurrency: cancel-in-progress: true jobs: - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + build: runs-on: ubuntu-latest steps: - name: Checkout @@ -33,9 +31,29 @@ jobs: run: npm ci - name: Build run: npm run build + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + retention-days: 1 + + deploy: + needs: build + if: github.ref == 'refs/heads/main' + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist - name: Setup Pages uses: actions/configure-pages@v4 - - name: Upload artifact + - name: Upload pages artifact uses: actions/upload-pages-artifact@v3 with: path: "./dist"