Merge pull request #247 from sebader/dependabot/npm_and_yarn/website/… #216
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: 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 |