Skip to content

Commit 214d4b6

Browse files
committed
6601: Updated image build actions to be dependent on release
1 parent b9f4377 commit 214d4b6

3 files changed

Lines changed: 19 additions & 18 deletions

File tree

.github/workflows/docker_build_images_from_tag.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
on:
3-
push:
4-
tags:
5-
- "*"
3+
workflow_run:
4+
workflows: ["Create Github Release"]
5+
types:
6+
- completed
67

78
# This Action builds to os2display/* using ./infrastructure/*
89
# @see https://docs.github.com/en/actions/tutorials/publish-packages/publish-docker-images#publishing-images-to-github-packages
@@ -16,6 +17,7 @@ env:
1617

1718
jobs:
1819
docker:
20+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1921
runs-on: ubuntu-latest
2022
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
2123
permissions:
@@ -26,6 +28,8 @@ jobs:
2628
steps:
2729
- name: Checkout repository
2830
uses: actions/checkout@v5
31+
with:
32+
ref: ${{ github.event.workflow_run.head_branch }}
2933

3034
- name: Set up QEMU
3135
uses: docker/setup-qemu-action@v3
@@ -47,15 +51,17 @@ jobs:
4751
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
4852
with:
4953
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_MAIN }}
54+
tags: |
55+
type=raw,value=${{ github.event.workflow_run.head_branch }}
5056
5157
- name: Build and push Docker image
52-
id: push
58+
id: push-main
5359
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
5460
with:
5561
context: ./infrastructure/display-api-service/
5662
file: ./infrastructure/display-api-service/Dockerfile
5763
build-args: |
58-
APP_VERSION=${{ github.ref }}
64+
APP_VERSION=${{ github.event.workflow_run.head_branch }}
5965
push: true
6066
tags: ${{ steps.meta-main.outputs.tags }}
6167
labels: ${{ steps.meta-main.outputs.labels }}
@@ -66,7 +72,7 @@ jobs:
6672
uses: actions/attest-build-provenance@v3
6773
with:
6874
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_MAIN}}
69-
subject-digest: ${{ steps.push.outputs.digest }}
75+
subject-digest: ${{ steps.push-main.outputs.digest }}
7076
push-to-registry: true
7177

7278
# Build Nginx (depends on main)
@@ -76,19 +82,17 @@ jobs:
7682
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
7783
with:
7884
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_NGINX }}
79-
80-
- name: Get the tag
81-
id: get_tag
82-
run: echo ::set-output name=git_tag::$(echo $GITHUB_REF_NAME)
85+
tags: |
86+
type=raw,value=${{ github.event.workflow_run.head_branch }}
8387
8488
- name: Build and push Docker image
85-
id: push
89+
id: push-nginx
8690
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
8791
with:
8892
context: ./infrastructure/nginx/
8993
file: ./infrastructure/nginx/Dockerfile
9094
build-args: |
91-
APP_VERSION=${{ steps.get_tag.outputs.git_tag }}
95+
APP_VERSION=${{ github.event.workflow_run.head_branch }}
9296
push: true
9397
tags: ${{ steps.meta-nginx.outputs.tags }}
9498
labels: ${{ steps.meta-nginx.outputs.labels }}
@@ -99,5 +103,5 @@ jobs:
99103
uses: actions/attest-build-provenance@v3
100104
with:
101105
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_NGINX}}
102-
subject-digest: ${{ steps.push.outputs.digest }}
106+
subject-digest: ${{ steps.push-nginx.outputs.digest }}
103107
push-to-registry: true

.github/workflows/docker_build_images_from_develop.yml renamed to .github/workflows/docker_build_stg_images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
on:
33
push:
44
branches:
5-
- "develop"
5+
- "release/*"
66

77
# This Action builds to os2display/* using ./infrastructure/*
88
name: Build docker image (develop)

.github/workflows/github_build_release.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
on:
44
push:
55
tags:
6-
- "*.*.*"
6+
- "*"
77

88
name: Create Github Release
99

@@ -20,9 +20,6 @@ jobs:
2020
- name: Checkout
2121
uses: actions/checkout@v4
2222

23-
- name: Install Task task runner
24-
uses: go-task/setup-task@v1
25-
2623
- name: Setup docker network
2724
run: |
2825
docker network create frontend

0 commit comments

Comments
 (0)