1.11.2 release #22
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
on: | |
push: | |
branches: | |
- main | |
- develop | |
env: | |
BUILD_VERSION: '1.11.2' | |
jobs: | |
select-environment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Select environment from branch name | |
id: select-environment | |
shell: pwsh | |
run: | | |
if ("${{github.ref}}" -eq "refs/heads/main") { | |
Write-Output "env-name=production" >> $env:GITHUB_OUTPUT | |
} | |
if ("${{github.ref}}" -eq "refs/heads/develop") { | |
Write-Output "env-name=development" >> $env:GITHUB_OUTPUT | |
} | |
outputs: | |
env-name: ${{steps.select-environment.outputs.env-name}} | |
build-client: | |
needs: select-environment | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{needs.select-environment.outputs.env-name}} | |
steps: | |
- name: Checkout repos | |
uses: actions/checkout@v4 | |
- name: Setup Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Update package.json | |
run: npm version ${{env.BUILD_VERSION}} --no-git-tag-version | |
- name: Update microsoft-identity-association.json | |
shell: pwsh | |
run: | | |
$path = 'public/.well-known/microsoft-identity-association.json' | |
$content = Get-Content -Path $path | |
$content = $content -replace "{{MSAL_CLIENT_ID}}", "${{secrets.MSAL_CLIENT_ID}}" | |
Out-File -FilePath $path -InputObject $content -Encoding UTF8 | |
- name: Update .env | |
shell: pwsh | |
run: | | |
$path = '.env' | |
$content = Get-Content -Path $path | |
$content = $content -replace "{{TELEMETRY_CONNECTION_STRING}}", "${{secrets.TELEMETRY_CONNECTION_STRING}}" | |
$content = $content -replace "{{MSAL_AUTHORITY}}", "${{secrets.MSAL_AUTHORITY}}" | |
$content = $content -replace "{{MSAL_CLIENT_ID}}", "${{secrets.MSAL_CLIENT_ID}}" | |
$content = $content -replace "{{PUBLIC_URL}}", "${{secrets.PUBLIC_URL}}" | |
Out-File -FilePath $path -InputObject $content -Encoding UTF8 | |
- name: Restore source | |
run: npm ci | |
- name: Audit source | |
run: npm audit --omit=dev | |
- name: Build source | |
run: npm run build | |
- name: Test source | |
run: npm run test:ci | |
- name: Upload build files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hitofude | |
path: dist | |
- name: Upload test results | |
uses: enricomi/publish-unit-test-result-action/composite@v2 | |
if: always() | |
with: | |
files: test/*.xml | |
check_name: test-results | |
- name: Upload coverage reports | |
uses: codecov/codecov-action@v4 | |
if: always() | |
with: | |
fail_ci_if_error: true | |
token: ${{secrets.CODECOV_TOKEN}} | |
deploy-client: | |
needs: | |
- select-environment | |
- build-client | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{needs.select-environment.outputs.env-name}} | |
steps: | |
- name: Download build files | |
uses: actions/download-artifact@v4 | |
with: | |
name: hitofude | |
path: artifact | |
- name: Connect to Azure | |
uses: azure/login@v2 | |
with: | |
creds: ${{secrets.AZURE_CREDENTIALS}} | |
- name: Upload to blob storage | |
uses: azure/cli@v2 | |
with: | |
inlineScript: | | |
az storage blob delete-batch --account-name ${{secrets.AZURE_STORAGE_ACCOUNT_NAME}} --auth-mode login --source '$web' | |
az storage blob upload-batch --account-name ${{secrets.AZURE_STORAGE_ACCOUNT_NAME}} --auth-mode login --destination '$web' --source artifact | |
az cdn endpoint purge --content-paths '/*' --profile-name ${{secrets.AZURE_CDN_PROFILE_NAME}} --name ${{secrets.AZURE_CDN_ENDPOINT_NAME}} --resource-group ${{secrets.AZURE_RESOURCE_GROUP_NAME}} |