Skip to content

Tokens Flow

Tokens Flow #387

name: PWABuilder Preview CI/CD
on:
workflow_dispatch:
push:
branches:
- staging
paths:
- "apps/pwabuilder/**"
- "libraries/manifest-validation/**"
- "libraries/site-analytics/**"
- "components/code-editor/**"
- "components/manifest-editor/**"
- "components/manifest-previewer/**"
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- staging
paths:
- "apps/pwabuilder/**"
- "libraries/manifest-validation/**"
- "libraries/site-analytics/**"
- "components/code-editor/**"
- "components/manifest-editor/**"
- "components/manifest-previewer/**"
jobs:
build_and_deploy_job:
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/pwabuilder
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: ⚙️ Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Make envfile
uses: SpicyPizza/[email protected]
with:
envkey_VITE_CLIENT_ID: ${{ secrets.MSAL_CLIENT_ID }}
file_name: .env
directory: apps/pwabuilder
- name: 🛠️ Build
run: |
npm install
npm run build
- name: 🚀 Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_GLACIER_097FE8710 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
app_location: "apps/pwabuilder/dist"
skip_app_build: true # Skip building the app using the default build commands for the specified app framework - optional
output_location: "" # Built app content directory - optional
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:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_GLACIER_097FE8710 }}
action: "close"