Skip to content

Merge pull request #244 from sebader/dev #214

Merge pull request #244 from sebader/dev

Merge pull request #244 from sebader/dev #214

name: Deploy SPA to Azure Static Web App
on:
workflow_dispatch:
push:
branches:
- main
- dev
paths:
- 'website/**'
- 'WebsiteBackendFunctions/**'
- '.github/workflows/azure-static-web-apps-white-pond-0976e3603.yml'
jobs:
staticwebbapp_build_and_deploy:
runs-on: ubuntu-latest
name: Build and Deploy SPA
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Inject commit version
shell: pwsh
run: |
$configFileContent = Get-Content website/public/config.js
$commitShaShort = "${{ github.sha }}".Substring(0,7) # get commit SHA and shorten to 7 chars
$configFileContent = $configFileContent -replace '(window.VERSION_LABEL = ")(.*)(")',"`${1}$commitShaShort`${3}"
echo "New config file content:"
$configFileContent
$configFileContent | Set-Content website/public/config.js
- name: Build And Deploy to Azure Static Web App
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_WHITE_POND_0976E3603 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/website" # App source code path
api_location: "/WebsiteBackendFunctions" # Api source code path - optional
output_location: "dist" # Built app content directory - optional
production_branch: "main"
###### End of Repository/Build Configurations ######
env:
NODE_VERSION: 18.12.1