Skip to content

Commit dd00997

Browse files
committed
Improve naming of push job
1 parent 745d20a commit dd00997

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/ci-cd.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
minor: ${{ steps.parse.outputs.minor }}
1818
patch: ${{ steps.parse.outputs.patch }}
1919
exists: ${{ steps.parse.outputs.exists }}
20+
pushable: ${{ steps.parse.outputs.pushable }}
2021
steps:
2122
- uses: actions/checkout@v3
2223
- uses: pkgxdev/dev@v0
@@ -35,11 +36,14 @@ jobs:
3536
git fetch --prune --unshallow --tags
3637
git show-ref --tags v$1 --quiet && echo "true" || echo "false"
3738
}
39+
exists=$(check_git_tag_exists "$VERSION")
40+
3841
echo "semver=$VERSION" >> $GITHUB_OUTPUT
3942
echo "major=$(parse_version_component "$VERSION" 1)" >> $GITHUB_OUTPUT
4043
echo "minor=$(parse_version_component "$VERSION" 2)" >> $GITHUB_OUTPUT
4144
echo "patch=$(parse_version_component "$VERSION" 3)" >> $GITHUB_OUTPUT
42-
echo "exists=$(check_git_tag_exists "$VERSION")" >> $GITHUB_OUTPUT
45+
echo "exists=$exists" >> $GITHUB_OUTPUT
46+
echo "pushable=$(( [ "$GITHUB_REF" == "refs/heads/main" ] && [ "$exists" == "false" ] ))" >> $GITHUB_OUTPUT
4347
echo GitHub Output: $(cat $GITHUB_OUTPUT)
4448
4549
build:
@@ -116,6 +120,7 @@ jobs:
116120
echo "✅ Test passed, outputs.result: ${{toJSON(steps.run.outputs.result)}}"
117121
118122
push:
123+
name: ${{ needs.version.outputs.pushable == 'true' && 'push' || 'push (dry-run)' }}
119124
runs-on: ubuntu-latest
120125
needs: [ version, build, e2e-tests ]
121126
permissions:
@@ -153,5 +158,5 @@ jobs:
153158
docker tag elixir_script:test "$tag"
154159
done
155160
- name: Push image
156-
if: ${{ github.ref == 'refs/heads/main' && needs.version.outputs.exists == 'false' }}
161+
if: needs.version.outputs.pushable == 'true'
157162
run: docker push --all-tags ghcr.io/gaggle/elixir_script

0 commit comments

Comments
 (0)