From 152293bbe40210f69066af5bda3222c009c7d1c6 Mon Sep 17 00:00:00 2001 From: Devin Haska Date: Mon, 14 Apr 2025 20:55:51 -0700 Subject: [PATCH] feat: add separate action for PRs vs pushes to main --- .forgejo/workflows/deploy.yml | 5 ++++- .forgejo/workflows/pr.yml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .forgejo/workflows/pr.yml diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml index f8a4fc8..a6a4b09 100644 --- a/.forgejo/workflows/deploy.yml +++ b/.forgejo/workflows/deploy.yml @@ -1,5 +1,8 @@ name: Build and Deploy -on: [push] +on: + push: + branches: + - main jobs: build_and_deploy: diff --git a/.forgejo/workflows/pr.yml b/.forgejo/workflows/pr.yml new file mode 100644 index 0000000..e5f88a4 --- /dev/null +++ b/.forgejo/workflows/pr.yml @@ -0,0 +1,35 @@ +name: Build and Deploy Staging +on: + pull_request: + branches: + - main + +jobs: + build_and_deploy: + runs-on: docker + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + + - name: Clean + run: npm run clean + + - name: Install dependencies + run: npm ci + + - name: Build the website + env: + DARK_VISITORS_ACCESS_TOKEN: "${{ secrets.DARK_VISITORS_ACCESS_TOKEN }}" + URL: "${{ secrets.STAGING_URL }}" + run: npm run build + + - name: Upload build + env: + BUNNY_ACCESS_KEY: "${{ secrets.STAGING_BUNNY_ACCESS_KEY }}" + BUNNY_STORAGE_ZONE_NAME: "${{ secrets.STAGING_BUNNY_STORAGE_ZONE_NAME }}" + run: npm run upload