Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/deploy-to-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Deploy to Azure Static Web Apps
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'development'
type: choice
options:
- production
- staging
- development
- testing
jobs:

set-github-environment:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.set-env.outputs.target_env }}
steps:
- name: Set Environment
id: set-env
run: |
case "${{ inputs.environment }}" in
testing) echo "target_env=Testing" >> $GITHUB_OUTPUT ;;
development) echo "target_env=dev" >> $GITHUB_OUTPUT ;;
staging) echo "target_env=stage" >> $GITHUB_OUTPUT ;;
production) echo "target_env=prod" >> $GITHUB_OUTPUT ;;
esac
Comment thread
coderabbitai[bot] marked this conversation as resolved.

build-and-deploy:
needs: set-github-environment
runs-on: ubuntu-latest
environment: ${{ needs.set-github-environment.outputs.environment }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.environment }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install Dependencies
run: npm install
- name: Ingest Environment Variables
run: |
touch .env
echo '${{ vars.ENV_CONFIG }}' | jq -r 'to_entries | map("\(.key)=\(.value)") | .[]' > .env
echo CI=false >> .env
- name: Build Project
run: npm run generate
- name: Copy WebApp Config
run: cp staticwebapp.config.json .output/public/staticwebapp.config.json

- name: Deploy to Azure Static Web Apps
id: deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: "upload"
app_location: ".output/public" # App source code path
api_location: "" # Api source code path - optional
output_location: "" # Built app content directory - optional
skip_app_build: true
5 changes: 5 additions & 0 deletions staticwebapp.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"navigationFallback": {
"rewrite": "/index.html"
}
}
Loading