update: bump version to latest #5
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 User Demo Environment | |
on: | |
push: | |
branches-ignore: | |
- main # This pattern ignores the main branch | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract branch name | |
id: extract_branch | |
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
- name: Print branch name | |
run: echo "The branch name is ${{ env.BRANCH_NAME }}" | |
- name: Deploy to environment | |
if: always() | |
env: | |
ENVIRONMENT_NAME: ${{ env.BRANCH_NAME }} | |
run: | | |
echo "Deploying to environment: $ENVIRONMENT_NAME" | |
- name: 'Az CLI login with Workload Identity Federation' | |
uses: azure/[email protected] | |
with: | |
client-id: ${{ secrets.ARM_CLIENT_ID }} | |
tenant-id: ${{ secrets.ARM_TENANT_ID }} | |
subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
- name: 'Validate Workload Identity Auth Works' | |
run: | | |
az account show | |
az group list | |
- uses: actions/checkout@v4 | |
- name: 'Terraform: Init' | |
working-directory: ./infra/terraform/ | |
env: | |
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
ARM_USE_OIDC: true | |
TF_BACKEND_STORAGE_RESOURCE_GROUP_NAME: ${{ vars.TF_BACKEND_STORAGE_RESOURCE_GROUP_NAME }} | |
TF_BACKEND_STORAGE_ACCOUNT_NAME: ${{ vars.TF_BACKEND_STORAGE_ACCOUNT_NAME }} | |
TF_BACKEND_STORAGE_CONTAINER_NAME: ${{ vars.TF_BACKEND_STORAGE_CONTAINER_NAME }} | |
run: | | |
terraform init -backend-config="resource_group_name=$TF_BACKEND_STORAGE_RESOURCE_GROUP_NAME" -backend-config="storage_account_name=$TF_BACKEND_STORAGE_ACCOUNT_NAME" -backend-config="container_name=$TF_BACKEND_STORAGE_CONTAINER_NAME" | |
- name: 'Terraform: Plan' | |
working-directory: ./infra/terraform/ | |
env: | |
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
ARM_USE_OIDC: true | |
TF_VAR_prefix: ${{ vars.PREFIX }} | |
TF_VAR_resource_group_name: ${{ vars.RESOURCE_GROUP_NAME }} | |
run: terraform plan -out tfplan | |
- name: 'Terraform: Apply' | |
working-directory: ./infra/terraform/ | |
env: | |
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
ARM_USE_OIDC: true | |
run: terraform apply tfplan | |
environment: | |
name: ${{ github.ref_name }} |