Skip to content

Commit

Permalink
simplify image publishing
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
  • Loading branch information
pablochacin committed Nov 19, 2024
1 parent 73ab21c commit f06c69d
Showing 1 changed file with 9 additions and 31 deletions.
40 changes: 9 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,52 +52,30 @@ jobs:
run: |
echo "${{ secrets.DOCKER_PASS }}" | docker login -u "${{ secrets.DOCKER_USER }}" --password-stdin
- name: Publish master image to ghcr.io
- name: Publish master image
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "Publish as ghcr.io/${IMAGE_REPOSITORY}:master"
echo "Publish as master"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ${IMAGE_REPOSITORY}:master \
-t "ghcr.io/${IMAGE_REPOSITORY}:master" .
- name: Publish tagged version image to ghcr.io
- name: Publish tagged version
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
VERSION="${VERSION#v}"
echo "Publish as ghcr.io/${IMAGE_REPOSITORY}:${VERSION}"
docker tag "$IMAGE_REPOSITORY" "ghcr.io/${IMAGE_REPOSITORY}:${VERSION}"
docker push "ghcr.io/${IMAGE_REPOSITORY}:${VERSION}"
# We also want to tag the latest stable version as latest
if [[ ! "$VERSION" =~ (RC|rc) ]]; then
echo "Publish as ghcr.io/${IMAGE_REPOSITORY}:latest"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ${IMAGE_REPOSITORY}:latest \
-t "ghcr.io/${IMAGE_REPOSITORY}:latest" .
fi
- name: Publish master image to Docker Hub
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "Publish as ${IMAGE_REPOSITORY}:master"
echo "Publish as ${VERSION}"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ${IMAGE_REPOSITORY}:master \
-t "ghcr.io/${IMAGE_REPOSITORY}:master" .
- name: Publish tagged version image to Docker Hub
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
VERSION="${VERSION#v}"
echo "Publish as ${IMAGE_REPOSITORY}:${VERSION}"
docker tag "$IMAGE_REPOSITORY" "${IMAGE_REPOSITORY}:${VERSION}"
docker push "${IMAGE_REPOSITORY}:${VERSION}"
--platform linux/amd64,linux/arm64 \
-t ${IMAGE_REPOSITORY}:${VERSION} \
-t "ghcr.io/${IMAGE_REPOSITORY}:${VERSION}" .
# We also want to tag the latest stable version as latest
if [[ ! "$VERSION" =~ (RC|rc) ]]; then
echo "Publish as ${IMAGE_REPOSITORY}:latest"
echo "Publish as latest"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ${IMAGE_REPOSITORY}:latest \
-t "ghcr.io/${IMAGE_REPOSITORY}:latest" .
fi

0 comments on commit f06c69d

Please sign in to comment.