Skip to content

Commit 1ad0fcb

Browse files
lwinmoepaingclaude
andcommitted
🔧 build(ci): skip deploy on pull requests, only build-test
PRs now only run install + build to verify the code compiles. Deploy to GitHub Pages only happens on push to main. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 16d5545 commit 1ad0fcb

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,36 @@
1-
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2-
#
3-
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4-
#
5-
name: Deploying Static Side With Bun And NextJS
1+
name: Build & Deploy
62

73
on:
8-
# Runs on pushes targeting the default branch
94
push:
105
branches: ["main"]
116
pull_request:
127
branches: ["main"]
13-
14-
# Allows you to run this workflow manually from the Actions tab
158
workflow_dispatch:
169

17-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1810
permissions:
1911
contents: read
2012
pages: write
2113
id-token: write
2214

23-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
24-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2515
concurrency:
2616
group: "pages"
2717
cancel-in-progress: false
2818

2919
jobs:
30-
# Build job
20+
# Build job — runs on both push and PR
3121
build:
3222
runs-on: ubuntu-latest
3323
steps:
3424
- name: Checkout
3525
uses: actions/checkout@v4
3626
- name: Setup Bun
3727
uses: oven-sh/setup-bun@v2
38-
- name: Setup Pages
39-
uses: actions/configure-pages@v5
4028
- name: Restore cache
4129
uses: actions/cache@v4
4230
with:
4331
path: |
4432
.next/cache
45-
# Generate a new cache whenever packages or source files change.
4633
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lockb') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
47-
# If source files changed but packages didn't, rebuild from a prior cache.
4834
restore-keys: |
4935
${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lockb') }}-
5036
- name: Install dependencies
@@ -59,13 +45,19 @@ jobs:
5945
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
6046
NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
6147
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
48+
# Only upload artifact for deployment on push to main
49+
- name: Setup Pages
50+
if: github.event_name == 'push'
51+
uses: actions/configure-pages@v5
6252
- name: Upload artifact
53+
if: github.event_name == 'push'
6354
uses: actions/upload-pages-artifact@v3
6455
with:
6556
path: ./out
6657

67-
# Deployment job
58+
# Deploy job — only runs on push to main, skipped for PRs
6859
deploy:
60+
if: github.event_name == 'push'
6961
environment:
7062
name: github-pages
7163
url: ${{ steps.deployment.outputs.page_url }}

0 commit comments

Comments
 (0)