Skip to content

ci/cd: azure workflow file update #2

ci/cd: azure workflow file update

ci/cd: azure workflow file update #2

name: Azure Static Web Apps CI/CD
on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize, reopened, closed ]
branches: [ main ]
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
lfs: false
# ---- Amplify preBuild equivalent: install pnpm + workspace install from repo root
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18' # Next 14 safe LTS
cache: 'pnpm'
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
# ---- Amplify cache equivalents
- name: Cache .next and pnpm store
uses: actions/cache@v4
with:
path: |
packages/frontend/.next/cache
node_modules/.pnpm
.pnpm-store
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
# ---- Build & Deploy (Amplify buildPath=/; then build app)
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_POND_070533700 }}
action: upload
# App folder (Amplify appRoot)
app_location: packages/frontend
# SSR/Hybrid Next.js on SWA → leave empty (Amplify artifacts were .next, SWA handles SSR internally)
output_location: ""
# Run install at repo root, then build the app (Amplify preBuild + build)
app_build_command: |
pnpm install --frozen-lockfile
pnpm --filter ./packages/frontend... run build
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
action: close