Staging #627
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PWABuilder Main CI/CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
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: | |
- main | |
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_NODE_ENV: "production" | |
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_NICE_FIELD_047C1420F }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | |
action: "upload" | |
app_location: "apps/pwabuilder/dist" | |
api_location: "api" # Api source code path - optional | |
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_NICE_FIELD_047C1420F }} | |
action: "close" |