Services Components with api tie-in (#1968) #32
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: Dev Frontend Build and Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'frontend/**' | |
env: | |
TF_IN_AUTOMATION: "True" | |
ENVIRONMENT: "dev" | |
WORKING_DIR: "frontend" | |
DOCKER_FILE: "Dockerfile.azure" | |
jobs: | |
build: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | |
- name: Build and publish the Docker image for ${{ github.repository }} | |
uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b4d44 #v13 | |
with: | |
image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} # it will be lowercased internally | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
context: ${{ github.workspace }}/${{ env.WORKING_DIR }} | |
dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DOCKER_FILE }} | |
image_tag: ${{ github.sha }} | |
build-asa: | |
permissions: | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@9b21598af8d4dfc302e5a30250007de0fda92acc #v1.1.1 | |
with: | |
bun-version: 1.0.15 | |
- name: Install dependencies | |
working-directory: ${{ env.WORKING_DIR }} | |
run: bun install | |
- name: Build Bun | |
uses: ./.github/actions/tf-apply | |
with: | |
terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa/build_bun" | |
azure_client_id: ${{ secrets.ARM_CLIENT_ID }} | |
azure_client_secret: ${{ secrets.ARM_CLIENT_SECRET }} | |
azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
azure_tenant_id: ${{ secrets.ARM_TENANT_ID }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tf_vars: | | |
{ | |
"environment": "${{ env.ENVIRONMENT }}", | |
"commit_hash": "${{ github.sha }}", | |
"frontend_dir": "../../../../../frontend" | |
} | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} | |
path: ${{ env.WORKING_DIR }}/build | |
frontend-deploy: | |
needs: build | |
permissions: | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | |
- name: Terraform Apply | |
uses: ./.github/actions/tf-apply | |
with: | |
terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend" | |
azure_client_id: ${{ secrets.ARM_CLIENT_ID }} | |
azure_client_secret: ${{ secrets.ARM_CLIENT_SECRET }} | |
azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
azure_tenant_id: ${{ secrets.ARM_TENANT_ID }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tf_vars: | | |
{ | |
"environment": "${{ env.ENVIRONMENT }}", | |
"container_tag": "${{ github.sha }}" | |
} | |
frontend-asa-deploy: | |
needs: build-asa | |
permissions: | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | |
- name: Download Frontend Artifacts | |
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 #v4.1 | |
with: | |
name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} | |
path: ${{ env.WORKING_DIR }}/build | |
- name: Terraform Apply | |
uses: ./.github/actions/tf-apply | |
with: | |
terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_asa" | |
azure_client_id: ${{ secrets.ARM_CLIENT_ID }} | |
azure_client_secret: ${{ secrets.ARM_CLIENT_SECRET }} | |
azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
azure_tenant_id: ${{ secrets.ARM_TENANT_ID }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tf_vars: | | |
{ | |
"environment": "${{ env.ENVIRONMENT }}", | |
"commit_hash": "${{ github.sha }}}" | |
} |