Skip to content

Merge branch 'main' into deploy #79

Merge branch 'main' into deploy

Merge branch 'main' into deploy #79

Workflow file for this run

name: deploy
on:
push:
branches: [ deploy ]
workflow_dispatch:
permissions:
contents: read
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_NOLOGO: true
NUGET_XMLDOC_MODE: skip
jobs:
build:
name: build
runs-on: ubuntu-latest
env:
PUBLISH_CONTAINER: ${{ github.ref_name == 'deploy' && vars.CONTAINER_REGISTRY != '' }}
outputs:
container-tag: ${{ steps.publish-container.outputs.container-tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
- name: Build and publish
shell: pwsh
env:
TreatWarningsAsErrors: true
run: ./build.ps1 -SkipTests
- name: Docker log in
uses: docker/login-action@v3
if: env.PUBLISH_CONTAINER == 'true'
with:
registry: ${{ vars.CONTAINER_REGISTRY }}
username: ${{ secrets.ACR_REGISTRY_USERNAME }}
password: ${{ secrets.ACR_REGISTRY_PASSWORD }}
- name: Publish container
id: publish-container
shell: pwsh
env:
ContainerRegistry: ${{ env.PUBLISH_CONTAINER == 'true' && vars.CONTAINER_REGISTRY || '' }}
run: |
dotnet publish ./src/ApplePayJS --arch x64 --os linux -p:PublishProfile=DefaultContainer
if (-Not [string]::IsNullOrWhiteSpace(${env:ContainerRegistry})) {
$containerTag = "${env:ContainerRegistry}/${env:GITHUB_REPOSITORY}:github-${env:GITHUB_RUN_NUMBER}".ToLowerInvariant()
"container-tag=${containerTag}" >> "${env:GITHUB_OUTPUT}"
}
deploy:
name: deploy-production
needs: build
runs-on: ubuntu-latest
concurrency: production_environment
environment:
name: production
url: ${{ vars.APPLICATION_URL }}
permissions:
id-token: write
steps:
- name: Azure log in
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy to Azure App Service
uses: azure/webapps-deploy@v3
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
images: ${{ needs.build.outputs.container-tag }}