From de868487ac8bc5b57ec0669b6fd9c6614f0a07c5 Mon Sep 17 00:00:00 2001 From: rebeccahongsf Date: Thu, 17 Oct 2024 11:02:12 -0700 Subject: [PATCH] swap backout for nextjs publish yml --- .github/workflows/deploy.yml | 18 ------------ .github/workflows/preview.yml | 46 +++++++++++++++---------------- .github/workflows/publish.yml | 52 +++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 95264f8..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,18 +0,0 @@ -# .github/workflows/deploy.yml -name: Deploy Main -on: - push: - branches: - - main -jobs: - deploy-preview: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: npm i && npm run build - - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: ./out - branch: gh-pages - clean-exclude: pr-preview - force: false diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 655100b..4f25d36 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -1,24 +1,24 @@ -# .github/workflows/preview.yml -name: Deploy PR previews -concurrency: preview-${{ github.ref }} -on: - pull_request: - types: - - opened - - reopened - - synchronize - - closed -jobs: - deploy-preview: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: npm i && npm run build - if: github.event.action != 'closed' - - uses: rossjrw/pr-preview-action@v1 - with: - source-dir: ./out - preview-branch: gh-pages - umbrella-dir: pr-preview - action: auto +# # .github/workflows/preview.yml +# name: Deploy PR previews +# concurrency: preview-${{ github.ref }} +# on: +# pull_request: +# types: +# - opened +# - reopened +# - synchronize +# - closed +# jobs: +# deploy-preview: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - run: npm i && npm run build +# if: github.event.action != 'closed' +# - uses: rossjrw/pr-preview-action@v1 +# with: +# source-dir: ./out +# preview-branch: gh-pages +# umbrella-dir: pr-preview +# action: auto \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..059294f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,52 @@ +# File: .github/workflows/publish.yml +name: Publish to Github Pages +on: + push: + branches: + - master + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v4 + + - name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧 + uses: ./.github/workflows/setup-node + + - name: Setup Pages ⚙️ + uses: actions/configure-pages@v4 + with: + static_site_generator: next + + - name: Build with Next.js 🏗️ + run: npx next build # TODO: return to update to use yarn build or simplify build process + + - name: Upload artifact 📡 + uses: actions/upload-pages-artifact@v3 + with: + path: ./out + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + needs: build + + steps: + - name: Publish to GitHub Pages 🚀 + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file