Skip to content

Commit 0cd3917

Browse files
authored
Ensure version output is always set (#3503)
even when github.event_name != 'push' by moving run step to same job as build-push action. Also set context path provided by checkout action to avoid future nonintuitive behavoir using default Git context, even when the checkout action appears to be being used. - https://github.com/docker/build-push-action#git-context - https://github.com/docker/build-push-action#path-context
1 parent 482017c commit 0cd3917

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/update_ci_image.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,13 @@ jobs:
1919
name: Check CI Files
2020
runs-on: ubuntu-latest
2121
outputs:
22-
version: ${{ steps.check.outputs.version }}
2322
trigger: ${{ steps.check.outputs.trigger }}
2423
no_cache: ${{ steps.check.outputs.no_cache }}
2524
steps:
26-
- uses: actions/checkout@v3
2725
- name: "Check package updates"
2826
id: check
2927
if: github.event_name == 'push'
3028
run: |
31-
version=$(grep -oP '(?<=<version>).*?(?=</version>)' navigation2/package.xml)
32-
echo "version=${version}" >> $GITHUB_OUTPUT
3329
echo "trigger=true" >> $GITHUB_OUTPUT
3430
echo "no_cache=false" >> $GITHUB_OUTPUT
3531
check_ci_image:
@@ -67,6 +63,7 @@ jobs:
6763
- check_ci_image
6864
runs-on: ubuntu-latest
6965
steps:
66+
- uses: actions/checkout@v3
7067
- name: Set up Docker Buildx
7168
uses: docker/setup-buildx-action@v2
7269
- name: Login to Docker Hub
@@ -78,6 +75,9 @@ jobs:
7875
- name: Set build config
7976
id: config
8077
run: |
78+
version=$(grep -oP '(?<=<version>).*?(?=</version>)' navigation2/package.xml)
79+
echo "version=${version}" >> $GITHUB_OUTPUT
80+
8181
no_cache=false
8282
if [ "${{needs.check_ci_files.outputs.no_cache}}" == 'true' ] || \
8383
[ "${{needs.check_ci_image.outputs.no_cache}}" == 'true' ]
@@ -98,16 +98,17 @@ jobs:
9898
id: docker_build
9999
uses: docker/build-push-action@v4
100100
with:
101-
provenance: false
101+
context: .
102102
pull: true
103103
push: true
104+
provenance: false
104105
no-cache: ${{ steps.config.outputs.no_cache }}
105106
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ github.ref_name }}
106107
cache-to: type=inline
107108
target: builder
108109
tags: |
109110
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
110-
ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ needs.check_ci_files.outputs.version }}
111+
ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ steps.config.outputs.version }}
111112
- name: Image digest
112113
if: steps.config.outputs.trigger == 'true'
113114
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)