From fda6f4b8dc9c36ad0997be871f73d7ba3eb26092 Mon Sep 17 00:00:00 2001 From: jollygrin Date: Tue, 10 Dec 2024 04:13:10 +0100 Subject: [PATCH] add deploy script --- .github/workflows/deploy.yaml | 90 +++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..7f035fc --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,90 @@ +name: Deploy Next.js site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 9 + run_install: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: pnpm + + - name: Install Dependencies + run: | + cd dcl-attend-frontend + pnpm install --frozen-lockfile + + - name: Setup Pages + uses: actions/configure-pages@v3 + with: + static_site_generator: next + + - name: Restore Next.js cache + uses: actions/cache@v3 + with: + path: dcl-attend-frontend/.next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('dcl-attend-frontend/**/pnpm-lock.yaml') }}-${{ hashFiles('dcl-attend-frontend/**.[jt]s', 'dcl-attend-frontend/**.[jt]sx') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('dcl-attend-frontend/**/pnpm-lock.yaml') }}- + + - name: Build with Next.js + run: | + cd dcl-attend-frontend + pnpm next build + + # - name: Run postbuild script + # run: | + # cd frontend + # pnpm node lib/buildTools/prefixFonts.js + + # - name: Export Static HTML with Next.js + # run: | + # cd frontend + # pnpm next export + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: ./dcl-attend-frontend/out + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2