Switch to static output and add Azure SWA deployment
- Set output: 'static' in astro.config.mjs; remove Vercel/Netlify adapters - Remove API routes (contact, newsletter) incompatible with static mode - Add Azure SWA deploy workflow using @azure/static-web-apps-cli via npx - Add public/staticwebapp.config.json for SWA routing and 404 fallback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
name: Deploy
|
||||
name: Deploy to Azure Static Web Apps
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build_and_deploy:
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -15,9 +17,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
run: corepack enable pnpm
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
@@ -28,46 +28,18 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Lint
|
||||
run: pnpm run lint
|
||||
|
||||
- name: Type check
|
||||
run: pnpm run check
|
||||
|
||||
- name: Build
|
||||
run: pnpm run build
|
||||
env:
|
||||
SITE_URL: ${{ secrets.SITE_URL }}
|
||||
|
||||
# Uncomment and configure for your deployment platform
|
||||
#
|
||||
# Vercel deployment:
|
||||
# - name: Deploy to Vercel
|
||||
# if: github.ref == 'refs/heads/main'
|
||||
# uses: amondnet/vercel-action@v25
|
||||
# with:
|
||||
# vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
||||
# vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
|
||||
# vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
# vercel-args: '--prod'
|
||||
#
|
||||
# Netlify deployment:
|
||||
# - name: Deploy to Netlify
|
||||
# if: github.ref == 'refs/heads/main'
|
||||
# uses: nwtgck/actions-netlify@v2
|
||||
# with:
|
||||
# publish-dir: './dist'
|
||||
# production-branch: main
|
||||
# github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# env:
|
||||
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
#
|
||||
# Cloudflare Pages deployment:
|
||||
# - name: Deploy to Cloudflare Pages
|
||||
# if: github.ref == 'refs/heads/main'
|
||||
# uses: cloudflare/wrangler-action@v3
|
||||
# with:
|
||||
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
# command: pages deploy dist --project-name=astro-rocket
|
||||
- name: Deploy to Azure Static Web Apps
|
||||
run: npx --yes @azure/static-web-apps-cli@latest deploy dist --deployment-token "${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}" --env production
|
||||
|
||||
close_pull_request:
|
||||
if: github.event_name == 'pull_request' && github.event.action == 'closed'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Close preview environment
|
||||
run: npx --yes @azure/static-web-apps-cli@latest deploy --deployment-token "${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}" --env close
|
||||
|
||||
Reference in New Issue
Block a user