From cd8175cb1b2bd94190ffe53fee227bf11120f82a Mon Sep 17 00:00:00 2001 From: Jonas Renggli Date: Mon, 20 Mar 2023 20:12:29 +0100 Subject: [PATCH 1/4] ci: Configure GitHub Action --- .github/workflows/docker-publish.yml | 67 ++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..db7eddb --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,67 @@ +name: Docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + schedule: + - cron: '39 16 * * 0' + push: + branches: [ "main" ] + tags: [ '*.*.*' ] + pull_request: + branches: [ "main" ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a + with: + context: sitediff/1.2.1 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/arm64/v8,linux/amd64 + cache-from: type=gha + cache-to: type=gha,mode=max From a4ef9ff1e1465b9a6b1d7d8d218842fd0bf2e127 Mon Sep 17 00:00:00 2001 From: Jonas Renggli Date: Mon, 20 Mar 2023 20:19:29 +0100 Subject: [PATCH 2/4] fixup! ci: Configure GitHub Action --- .github/workflows/docker-publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index db7eddb..0a8ba09 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -58,7 +58,8 @@ jobs: id: build-and-push uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a with: - context: sitediff/1.2.1 + context: ./sitediff/1.2.1/ + file: ./Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From b84ced6a3db0c34f0a5ffa0e741c309f06c81ced Mon Sep 17 00:00:00 2001 From: Jonas Renggli Date: Mon, 20 Mar 2023 20:23:18 +0100 Subject: [PATCH 3/4] fixup! fixup! ci: Configure GitHub Action --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0a8ba09..a5aa72f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -59,7 +59,7 @@ jobs: uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a with: context: ./sitediff/1.2.1/ - file: ./Dockerfile + file: ./sitediff/1.2.1/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 65bd814ce2b1ef97bf97fdb85a29d92f24dc7a34 Mon Sep 17 00:00:00 2001 From: Jonas Renggli Date: Mon, 20 Mar 2023 20:29:09 +0100 Subject: [PATCH 4/4] fixup! fixup! fixup! ci: Configure GitHub Action --- .github/workflows/docker-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index a5aa72f..e874c52 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -29,6 +29,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + with: + submodules: true # Workaround: https://github.com/docker/build-push-action/issues/461 - name: Setup Docker buildx