Deploy to environment #272
This file contains hidden or 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 }} | |
| SLACK_URL: ${{ secrets.SLACK_URL }} | |
| MASKINPORTEN_ENVIRONMENT: ${{ secrets.MASKINPORTEN_ENVIRONMENT }} | |
| STATISTICS_API_KEY: ${{ secrets.STATISTICS_API_KEY }} | |
| - 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 }} | |
| MASKINPORTEN_ENVIRONMENT: ${{ secrets.MASKINPORTEN_ENVIRONMENT }} | |
| APIM_IP: ${{ secrets.APIM_IP }} | |