From cf0fc956c9ea210e54b4ddf15e64910e4fc828e1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 14 Aug 2022 17:05:13 +0200 Subject: [PATCH 1/2] Added publishing of the docker image in GHCR --- .github/workflows/docker-image-build.yml | 14 ++++++++++---- docker/build | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-image-build.yml b/.github/workflows/docker-image-build.yml index a7581b5f..63020514 100644 --- a/.github/workflows/docker-image-build.yml +++ b/.github/workflows/docker-image-build.yml @@ -14,15 +14,21 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 with: version: latest - name: Login to docker hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build the image + - name: Login to GitHub container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_PAT }} + - name: Build and push the image run: bash ./docker/build diff --git a/docker/build b/docker/build index fdd58106..5d59bd9d 100755 --- a/docker/build +++ b/docker/build @@ -8,9 +8,9 @@ DOCKER_IMAGE="shlinkio/shlink" # If ref is not develop, then this is a tag. Build that docker tag and also "stable" if [[ "$GITHUB_REF" != *"develop"* ]]; then VERSION=${GITHUB_REF#refs/tags/v} - TAGS="-t ${DOCKER_IMAGE}:${VERSION}" + TAGS="-t ${DOCKER_IMAGE}:${VERSION} -t ghcr.io/${DOCKER_IMAGE}:${VERSION}" # Push stable tag only if this is not an alpha or beta tag - [[ $GITHUB_REF != *"alpha"* && $GITHUB_REF != *"beta"* ]] && TAGS="${TAGS} -t ${DOCKER_IMAGE}:stable" + [[ $GITHUB_REF != *"alpha"* && $GITHUB_REF != *"beta"* ]] && TAGS="${TAGS} -t ${DOCKER_IMAGE}:stable -t ghcr.io/${DOCKER_IMAGE}:stable" docker buildx build --push \ --build-arg SHLINK_VERSION=${VERSION} \ @@ -21,5 +21,5 @@ if [[ "$GITHUB_REF" != *"develop"* ]]; then elif [[ "$GITHUB_REF" == *"develop"* ]]; then docker buildx build --push \ --platform ${PLATFORMS} \ - -t ${DOCKER_IMAGE}:latest . + -t ${DOCKER_IMAGE}:latest -t ghcr.io/${DOCKER_IMAGE}:latest . fi From 5c2061a6e685aa58e55dba12f0f97451a48b6ecf Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 14 Aug 2022 17:07:07 +0200 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2ec6b82..691af5de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this Non-error responses are not affected. +* [#1513](https://github.com/shlinkio/shlink/issues/1513) Added publishing of the docker image in GHCR. + ### Changed * [#1339](https://github.com/shlinkio/shlink/issues/1339) Added new test suite for CLI E2E tests. * [#1503](https://github.com/shlinkio/shlink/issues/1503) Drastically improved build time in GitHub Actions, by optimizing parallelization, adding php extensions cache and running mutation tests only for changed files.