This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
v2.26.0 #30
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 production environment | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: ${{ vars.REGISTRY_NAME }}.azurecr.io/${{ vars.IMAGE_NAME }}:${{ github.event.release.tag_name }} | |
jobs: | |
promote-image: | |
name: Promote container image for production | |
runs-on: ubuntu-latest | |
environment: production | |
permissions: | |
contents: read | |
id-token: write | |
env: | |
SOURCE_IMAGE_NAME: ${{ vars.REGISTRY_NAME }}.azurecr.io/${{ vars.IMAGE_NAME }}:${{ github.sha }} | |
TARGET_IMAGE_NAME: ${{ vars.IMAGE_NAME }}:${{ github.event.release.tag_name }} | |
steps: | |
- name: Login to Azure | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ vars.AZURE_CLIENT_ID }} | |
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
tenant-id: ${{ vars.AZURE_TENANT_ID }} | |
- name: Tag staging image as production | |
run: | | |
az acr import \ | |
--name ${{ vars.REGISTRY_NAME }} \ | |
--source ${{ env.SOURCE_IMAGE_NAME }} \ | |
--image ${{ env.TARGET_IMAGE_NAME }} | |
apply: | |
name: Apply production environment | |
environment: production | |
runs-on: ubuntu-latest | |
needs: | |
- promote-image | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Terraform apply | |
uses: ./.github/actions/terraform-apply | |
with: | |
image-name: ${{ env.IMAGE_NAME }} | |
tf-api-token: ${{ secrets.TF_API_TOKEN }} | |
tf-cloud-organization: ${{ vars.TF_CLOUD_ORGANIZATION }} | |
tf-cloud-workspace: ${{ vars.TF_CLOUD_WORKSPACE }} | |
working-directory: ${{ vars.TF_WORKING_DIRECTORY }} |