@@ -56,35 +56,37 @@ jobs:
56
56
nix build .#docker-${{ matrix.target }}
57
57
docker load < result
58
58
59
- # Determine whether we are building a tag and if yes, set a VERSION_NAME
59
+ - name : Tag images
60
+ run : |
61
+
62
+ # Determine whether we are building a tag and if yes, set a
63
+ # VERSION_NAME, if not, use `unstable` as the version name.
60
64
BUILDING_TAG=${{github.ref_type == 'tag'}}
65
+ VERSION_NAME=unstable
61
66
[[ ${BUILDING_TAG} = true ]] && \
62
67
VERSION_NAME=${{github.ref_name}}
63
68
64
- # Determine if we are building on master
65
- BUILDING_ON_MASTER=false
66
- [[ ${GITHUB_REF_NAME} == 'master' ]] && BUILDING_ON_MASTER=true
67
-
68
69
# Use 'FROM' instruction to use docker build with --label
69
70
echo "FROM ${{matrix.target}}" | docker build \
70
71
--label org.opencontainers.image.source=https://github.com/cardano-scaling/hydra \
71
72
--label org.opencontainers.image.licenses=Apache-2.0 \
72
73
--label org.opencontainers.image.created=$(date -Is) \
73
74
--label org.opencontainers.image.revision=${{github.sha}} \
74
- --label org.opencontainers.image.version=${VERSION_NAME:-unstable} \
75
- --tag ${IMAGE_NAME}:unstable -
75
+ --label org.opencontainers.image.version=${VERSION_NAME} \
76
+ --tag ${IMAGE_NAME}:${VERSION_NAME} -
77
+
78
+ [[ ${GITHUB_REF_NAME} = "release" ]] && \
79
+ docker tag ${IMAGE_NAME} ${IMAGE_NAME}:latest
76
80
77
- # Also tag with 'latest' if we are building on master
78
- [[ ${BUILDING_ON_MASTER} = true ]] && \
79
- docker tag ${IMAGE_NAME}:unstable ${IMAGE_NAME}:latest
80
81
# Also tag with version if we are building a tag
81
82
[[ ${BUILDING_TAG} = true && ${{matrix.target}} != "hydraw" ]] && \
82
- docker tag ${IMAGE_NAME}:unstable ${IMAGE_NAME}:${VERSION_NAME}
83
+ docker tag ${IMAGE_NAME} ${IMAGE_NAME}:${VERSION_NAME}
84
+
83
85
# Also tag with ref name when manually dispatched
84
86
[[ ${{github.event_name == 'workflow_dispatch'}} = true ]] && \
85
- docker tag ${IMAGE_NAME}:unstable ${IMAGE_NAME}:workflow_dispatch-${{github.event.inputs.ref_name}}
87
+ docker tag ${IMAGE_NAME} ${IMAGE_NAME}:workflow_dispatch-${{github.event.inputs.ref_name}}
86
88
87
- docker inspect ${IMAGE_NAME}:unstable
89
+ docker inspect ${IMAGE_NAME}
88
90
docker images
89
91
90
92
- name : 📤 Push to registry
0 commit comments