-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 2.16 KB
/
build-n-push-main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Deploy from branch to DEV
on:
workflow_dispatch:
# inputs:
# skip-unit-test:
# type: boolean
# required: true
# description: Skip unit-test
jobs:
build_push_update:
runs-on: ubuntu-22.04
environment: cstar-d-weu-rtp
permissions:
id-token: write
packages: write
steps:
#
# Checkout the source code.
#
- name: Checkout the source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
#
# Build and push native container image.
#
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GIT_PAT }}
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Build the app image
id: image
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
push: true
context: .
file: src/main/docker/Dockerfile
platforms: linux/amd64
tags: ghcr.io/${{ github.repository }}:latest, ghcr.io/${{ github.repository }}:${{ github.ref_name }}
secrets: |
"gh_token=${{ secrets.GIT_PAT }}"
#
# Update Container App.
#
- name: Update Container App
shell: bash
working-directory: src/main/terraform
env:
ARM_CLIENT_ID: "${{ secrets.AZURE_CLIENT_ID }}"
ARM_SUBSCRIPTION_ID: "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
ARM_TENANT_ID: "${{ secrets.AZURE_TENANT_ID }}"
run: |
terraform init -backend-config="env/cstar-d-weu-rtp/backend.tfvars" -reconfigure
terraform apply -var-file="env/cstar-d-weu-rtp/terraform.tfvars" -var="rtp_activator_image=ghcr.io/${{ github.repository }}:${{ github.ref_name }}@${{ steps.image.outputs.digest }}" -auto-approve -lock-timeout=300s