Deploy Dashboard #15
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 Dashboard | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: "Environment to deploy to" | |
options: | |
- test | |
- staging | |
- production | |
- yt01 | |
- at21 | |
- at22 | |
- at23 | |
- at24 | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
environment: ${{ github.event.inputs.environment }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push image to registry | |
shell: bash | |
run: | | |
# Construct the image tag using the Git hash | |
IMAGE=ghcr.io/altinn/altinn-correspondence/altinn-correspondence-dashboard:${{ github.sha }} | |
docker build -f tools/Altinn.Correspondence.Dashboard/Dockerfile . --tag $IMAGE | |
docker push $IMAGE | |
- name: Azure Login | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Deploy Bicep | |
uses: azure/arm-deploy@v1 | |
env: | |
AZURE_NAME_PREFIX: ${{ secrets.AZURE_NAME_PREFIX }} | |
containerImage: ghcr.io/altinn/altinn-correspondence/altinn-correspondence-dashboard:${{ github.sha }} | |
AZURE_ENVIRONMENT_KEY_VAULT_NAME: ${{ secrets.AZURE_ENVIRONMENT_KEY_VAULT_NAME }} | |
AZURE_APP_REGISTRATION_ID: ${{ secrets.AZURE_APP_REGISTRATION_ID }} | |
AZURE_APP_REGISTRATION_CLIENT_SECRET: ${{ secrets.AZURE_APP_REGISTRATION_CLIENT_SECRET }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
DASHBOARD_ALLOWED_GROUP_ID: ${{ secrets.AZURE_TEST_ACCESS_CLIENT_ID }} | |
with: | |
scope: resourcegroup | |
resourceGroupName: ${{ secrets.AZURE_NAME_PREFIX }}-rg | |
template: .azure/applications/dashboard/main.bicep | |
parameters: .azure/applications/dashboard/main.bicepparam |