Skip to content

Commit

Permalink
Better deployment builds
Browse files Browse the repository at this point in the history
  • Loading branch information
derkoe committed Apr 29, 2023
1 parent 5226224 commit 9f25659
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 122 deletions.
39 changes: 25 additions & 14 deletions .github/workflows/deploy-to-azure.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Azure Static Web Apps CI/CD
name: Deploy to Azure Static Web Apps

on:
push:
Expand All @@ -14,30 +14,41 @@ permissions:
pull-requests: write

jobs:
build_and_deploy_job:
publish:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
name: Build and Deploy to Azure SWA
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.4

- name: Setup Node
uses: actions/setup-node@v3
with:
submodules: true
- name: Build And Deploy
id: builddeploy
node-version: 18.x
cache: "pnpm"
registry-url: https://registry.npmjs.org/

- name: Install NPM Dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm run build.azure

- name: Deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: "azure-functions" # Api source code path - optional
output_location: "dist" # Built app content directory - optional
app_location: "dist"
api_location: "azure-functions"
skip_app_build: true
skip_api_build: true
###### End of Repository/Build Configurations ######

close_pull_request_job:
delete_deployment:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/deploy-to-cloudflare.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
name: Deploy to CloudFlare
name: Deploy to CloudFlare Pages

on: [push]
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main

permissions:
contents: read
deployments: write

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
steps:
- name: Checkout
Expand All @@ -25,11 +33,8 @@ jobs:
- name: Install NPM Dependencies
run: pnpm install --frozen-lockfile

- name: Format check
run: pnpm run fmt.check

- name: Build
run: pnpm run build
run: pnpm run build.cloudflare

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ pnpm-lock.yaml
package-lock.json
yarn.lock
server
azure-functions/render
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
},
"license": "MIT",
"scripts": {
"build": "npm run build.client && npm run build.azure && npm run build.cloudflare",
"build": "echo 'Run build.azure or build.cloudflare' && false",
"build.azure": "run-p lint fmt.check build.types build.client build.server.azure",
"build.cloudflare": "run-p lint fmt.check build.types build.client build.server.cloudflare",
"build.client": "vite build",
"build.preview": "vite build --ssr src/entry.preview.tsx",
"build.azure": "vite build -c adapters/azure-swa/vite.config.ts",
"build.cloudflare": "vite build -c adapters/cloudflare-pages/vite.config.ts",
"build.server.azure": "vite build -c adapters/azure-swa/vite.config.ts",
"build.server.cloudflare": "vite build -c adapters/cloudflare-pages/vite.config.ts",
"build.types": "tsc --incremental --noEmit",
"dev": "vite --mode ssr",
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
Expand Down Expand Up @@ -42,6 +44,7 @@
"eslint": "8.39.0",
"eslint-plugin-qwik": "0.105.0",
"node-fetch": "3.3.1",
"npm-run-all": "4.1.5",
"prettier": "2.8.8",
"typescript": "5.0.4",
"undici": "5.22.0",
Expand Down
Loading

0 comments on commit 9f25659

Please sign in to comment.