diff --git a/.github/workflows/release_image.yml b/.github/workflows/release_image.yml index 927b9f2..ebf8d34 100644 --- a/.github/workflows/release_image.yml +++ b/.github/workflows/release_image.yml @@ -44,6 +44,14 @@ jobs: - name: Bundle install run: bundle install + - name: Log into ghcr registry + if: github.event_name != 'pull_request' + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Release image run: script/release-workflow/run.sh env: diff --git a/script/release-workflow/docker-push.sh b/script/release-workflow/docker-push.sh index adbc365..a9b6474 100755 --- a/script/release-workflow/docker-push.sh +++ b/script/release-workflow/docker-push.sh @@ -2,18 +2,29 @@ set -euo >/dev/null +## Publish a multi arch build +## ($TAG||$MAJOR_TAG||$LATEST) push() { + ## These will use cached builds, so wont build every time. docker buildx build --platform=linux/amd64,linux/arm64,linux/arm \ --output=type=image,push=true \ -t ${DOCKER_IMAGE_ORG_AND_NAME}:$1 . } +push_ghcr() { + docker buildx build --platform=linux/amd64,linux/arm64,linux/arm \ + --output=type=image,push=true \ + -t ghcr.io/${DOCKER_IMAGE_ORG_AND_NAME}:$1 +} if [ -n "${MAJOR_TAG:-}" ]; then push ${MAJOR_TAG} + push_ghcr ${MAJOR_TAG} fi push ${TAG} +push_ghcr ${TAG} if [ "${PUSH_TO_LATEST}" != "false" ]; then push latest -fi \ No newline at end of file + push_ghcr latest +fi