11---
22on :
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
1617
1718jobs :
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 :
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 }}
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 }}
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
0 commit comments