Deploy to environment #125
Workflow file for this run
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 to environment | |
on: | |
workflow_call: | |
inputs: | |
environment: | |
type: string | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
options: | |
- test | |
- staging | |
- production | |
jobs: | |
get-version: | |
name: Get version | |
runs-on: ubuntu-latest | |
outputs: | |
imageTag: ${{ steps.get-version.outputs.imageTag }} | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Get current version" | |
uses: ./.github/actions/get-current-version | |
id: get-version | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: [get-version] | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Publish image" | |
uses: ./.github/actions/publish-image | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
dockerImageBaseName: ghcr.io/altinn/altinn-broker | |
imageTag: ${{ needs.get-version.outputs.imageTag }} | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: ${{ inputs.environment }} | |
needs: [get-version, publish] | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update infrastructure | |
uses: ./.github/actions/update-infrastructure | |
with: | |
region: norwayeast | |
environment: ${{ inputs.environment }} | |
AZURE_NAME_PREFIX: ${{ secrets.AZURE_NAME_PREFIX }} | |
AZURE_ENVIRONMENT_KEY_VAULT_NAME: ${{ secrets.AZURE_ENVIRONMENT_KEY_VAULT_NAME }} | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
AZURE_TEST_ACCESS_CLIENT_ID: ${{ secrets.AZURE_TEST_ACCESS_CLIENT_ID }} | |
AZURE_MIGRATION_STORAGE_ACCOUNT_NAME: ${{ secrets.AZURE_MIGRATION_STORAGE_ACCOUNT_NAME }} | |
MASKINPORTEN_JWK: ${{ secrets.MASKINPORTEN_JWK }} | |
MASKINPORTEN_CLIENT_ID: ${{ secrets.MASKINPORTEN_CLIENT_ID }} | |
PLATFORM_SUBSCRIPTION_KEY: ${{ secrets.PLATFORM_SUBSCRIPTION_KEY }} | |
NOTIFICATION_EMAIL: ${{ secrets.NOTIFICATION_EMAIL }} | |
- name: Migrate database | |
uses: ./.github/actions/migrate-database | |
with: | |
region: norwayeast | |
environment: ${{ inputs.environment }} | |
AZURE_NAME_PREFIX: ${{ secrets.AZURE_NAME_PREFIX }} | |
AZURE_ENVIRONMENT_KEY_VAULT_NAME: ${{ secrets.AZURE_ENVIRONMENT_KEY_VAULT_NAME }} | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
AZURE_MIGRATION_STORAGE_ACCOUNT_NAME: ${{ secrets.AZURE_MIGRATION_STORAGE_ACCOUNT_NAME }} | |
- name: Release version | |
uses: ./.github/actions/release-version | |
with: | |
region: norwayeast | |
environment: ${{ inputs.environment }} | |
imageTag: ${{ needs.get-version.outputs.imageTag }} | |
AZURE_NAME_PREFIX: ${{ secrets.AZURE_NAME_PREFIX }} | |
AZURE_ENVIRONMENT_KEY_VAULT_NAME: ${{ secrets.AZURE_ENVIRONMENT_KEY_VAULT_NAME }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
PLATFORM_BASE_URL: ${{ secrets.PLATFORM_BASE_URL }} | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |