Skip to content

Commit

Permalink
Merge pull request #172 from pact-foundation/docker/publish_to_ghcr
Browse files Browse the repository at this point in the history
feat: Docker/publish to ghcr
  • Loading branch information
YOU54F committed Feb 26, 2024
2 parents d601374 + b54b96b commit 9124cad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ jobs:
- uses: ruby/setup-ruby@v1
- 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:
Expand Down
8 changes: 8 additions & 0 deletions script/release-workflow/docker-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ push() {
--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
push_ghcr latest
fi

0 comments on commit 9124cad

Please sign in to comment.