Skip to content

Commit

Permalink
use branch name as the version name to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
ffakenz committed Dec 2, 2024
1 parent 431dd60 commit b34f62a
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/docker-custom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,27 @@ jobs:
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV
nix build .#docker-hydra-node
./result | docker load
VERSION_NAME=${{github.ref_name}}
BRANCH_NAME="${{ github.event.inputs.branch_name }}"
[[ -z "${BRANCH_NAME}" ]] && { echo "branch_name is required"; exit 1; }
DATETIME=$(date '+%Y%m%d%H%M')
CUSTOM_TAG="hydra-node-${DATETIME}-${BRANCH_NAME}"
docker tag ${IMAGE_NAME}:unstable ${IMAGE_NAME}:${CUSTOM_TAG}
docker images
docker inspect ${IMAGE_NAME}:unstable
CUSTOM_TAG="${DATETIME}-${BRANCH_NAME}"
echo "CUSTOM_TAG=${CUSTOM_TAG}" >> $GITHUB_ENV
# Use 'FROM' instruction to use docker build with --label
echo "FROM hydra-node" | docker build \
--label org.opencontainers.image.source=https://github.com/cardano-scaling/hydra \
--label org.opencontainers.image.licenses=Apache-2.0 \
--label org.opencontainers.image.created=$(date -Is) \
--label org.opencontainers.image.revision=${{github.sha}} \
--label org.opencontainers.image.version=${VERSION_NAME:-unstable} \
--tag ${IMAGE_NAME}:${CUSTOM_TAG} -
docker inspect ${IMAGE_NAME}:${CUSTOM_TAG}
- name: 📤 Push to registry
run: |
docker push -a ${IMAGE_NAME}
docker push -a ${IMAGE_NAME}:${CUSTOM_TAG}

0 comments on commit b34f62a

Please sign in to comment.