17
17
minor : ${{ steps.parse.outputs.minor }}
18
18
patch : ${{ steps.parse.outputs.patch }}
19
19
exists : ${{ steps.parse.outputs.exists }}
20
+ pushable : ${{ steps.parse.outputs.pushable }}
20
21
steps :
21
22
- uses : actions/checkout@v3
22
23
- uses : pkgxdev/dev@v0
@@ -35,11 +36,14 @@ jobs:
35
36
git fetch --prune --unshallow --tags
36
37
git show-ref --tags v$1 --quiet && echo "true" || echo "false"
37
38
}
39
+ exists=$(check_git_tag_exists "$VERSION")
40
+
38
41
echo "semver=$VERSION" >> $GITHUB_OUTPUT
39
42
echo "major=$(parse_version_component "$VERSION" 1)" >> $GITHUB_OUTPUT
40
43
echo "minor=$(parse_version_component "$VERSION" 2)" >> $GITHUB_OUTPUT
41
44
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
43
47
echo GitHub Output: $(cat $GITHUB_OUTPUT)
44
48
45
49
build :
@@ -116,6 +120,7 @@ jobs:
116
120
echo "✅ Test passed, outputs.result: ${{toJSON(steps.run.outputs.result)}}"
117
121
118
122
push :
123
+ name : ${{ needs.version.outputs.pushable == 'true' && 'push' || 'push (dry-run)' }}
119
124
runs-on : ubuntu-latest
120
125
needs : [ version, build, e2e-tests ]
121
126
permissions :
@@ -153,5 +158,5 @@ jobs:
153
158
docker tag elixir_script:test "$tag"
154
159
done
155
160
- name : Push image
156
- if : ${{ github.ref == 'refs/heads/main' && needs.version.outputs.exists == 'false' }}
161
+ if : needs.version.outputs.pushable == 'true'
157
162
run : docker push --all-tags ghcr.io/gaggle/elixir_script
0 commit comments