From a86e58e37a805daed76ce5783189d5b685cff758 Mon Sep 17 00:00:00 2001 From: Martin Buchleitner Date: Tue, 22 Nov 2022 12:57:47 +0100 Subject: [PATCH] feat: ghcr-support (#16) --- .github/workflows/ci.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9505e76..da7e584 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,7 @@ name: Infralovers Container Build +# ref: github.com/infralovers/github/workflow-templates/container.yml + on: push: branches: [ 'main' ] @@ -13,13 +15,16 @@ jobs: version: ${{ steps.semrel.outputs.version }} steps: - uses: actions/checkout@v3 + - name: Check pre-commit presence id: precommit_exists uses: andstor/file-existence-action@v1 with: files: ".pre-commit-config.yaml" + - uses: actions/setup-python@v3 if: steps.precommit_exists.outputs.files_exists == 'true' + - uses: pre-commit/action@v3.0.0 if: steps.precommit_exists.outputs.files_exists == 'true' @@ -50,6 +55,7 @@ jobs: fi HUB_IMAGE="docker.io/$IMAGE_REPO/$IMAGE_NAME" QUAY_IMAGE="quay.io/$IMAGE_REPO/$IMAGE_NAME" + GHCR_IMAGE="ghcr.io/${{ github.repository }}" VERSION="dev" if [[ '${{ needs.prebuild.outputs.version }}' != '' ]]; then VERSION="${{ needs.prebuild.outputs.version }}" @@ -57,12 +63,12 @@ jobs: if [ "${{ github.event_name }}" = "schedule" ]; then VERSION="nightly" fi - TAGS="${QUAY_IMAGE}:${VERSION},${HUB_IMAGE}:${VERSION}" + TAGS="${QUAY_IMAGE}:${VERSION},${HUB_IMAGE}:${VERSION},${GHCR_IMAGE}:${VERSION}" if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - TAGS="$TAGS,${QUAY_IMAGE}:latest,${HUB_IMAGE}:latest" + TAGS="$TAGS,${QUAY_IMAGE}:latest,${HUB_IMAGE}:latest,${GHCR_IMAGE}:latest" fi echo "settings tag ${TAGS}" - echo ::set-output name=tags::${TAGS} + echo "tags=${TAGS}" >> $GITHUB_OUTPUT - name: Set up Docker Buildx id: buildx @@ -91,6 +97,13 @@ jobs: username: ${{ secrets.QUAY_USER }} password: ${{ secrets.QUAY_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.BOT_ACCESS_TOKEN }} + - name: Build and push id: docker_build uses: docker/build-push-action@v2