From b9011526f958e4849daaeafeb9db790f750e5ba9 Mon Sep 17 00:00:00 2001 From: Martin Ruckli Date: Sun, 5 Nov 2023 22:27:19 +0100 Subject: [PATCH 1/4] updates publish workflow to point to own registry --- .github/workflows/publish.yml | 44 +++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 81bf7d43..5f1c715f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,44 +5,48 @@ on: tags: - "v*" +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: - publish-docker: - name: Publish Docker Image + build-and-push-image: runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + steps: - - name: Checkout source code - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v4 with: ref: ${{ github.ref }} lfs: true + - name: Extract release channel id: channel run: | channel=$(cut -d - -f 2 <<< "${{ github.ref_name }}") echo "channel=$channel" >> $GITHUB_OUTPUT - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: ghcr.io/unusualalpha/ib-gateway - flavor: | - latest=false - tags: | - type=match,pattern=v(\d+.\d+),group=1 - type=match,pattern=v(\d+.\d+.\w+),group=1 - type=match,pattern=v(\d+.\d+.\w+)+\-(stable|latest),group=2 - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: - registry: ghcr.io + registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v3 + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: - context: ${{ steps.channel.outputs.channel }} + context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From e6c708e19bdabeef2ed4a0174cddbafdcdd683b7 Mon Sep 17 00:00:00 2001 From: Martin Ruckli Date: Sun, 5 Nov 2023 22:33:22 +0100 Subject: [PATCH 2/4] changes user.email to <> --- .github/workflows/detect-releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/detect-releases.yml b/.github/workflows/detect-releases.yml index aca01a88..d81aff51 100644 --- a/.github/workflows/detect-releases.yml +++ b/.github/workflows/detect-releases.yml @@ -71,7 +71,7 @@ jobs: run: | t_branch='update-${{ matrix.channel }}-to-${{ steps.version.outputs.build_version }}' git config user.name github-actions - git config user.email github-actions@github.com + git config user.email <> git pull git checkout -b "$t_branch" origin/master git add '${{ matrix.channel }}' From 4191ef67132c708dd4fe9a1dc5208f329be56b86 Mon Sep 17 00:00:00 2001 From: Martin Ruckli Date: Sun, 5 Nov 2023 22:44:20 +0100 Subject: [PATCH 3/4] adds missing quotes to <> --- .github/workflows/detect-releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/detect-releases.yml b/.github/workflows/detect-releases.yml index d81aff51..b22e6810 100644 --- a/.github/workflows/detect-releases.yml +++ b/.github/workflows/detect-releases.yml @@ -71,7 +71,7 @@ jobs: run: | t_branch='update-${{ matrix.channel }}-to-${{ steps.version.outputs.build_version }}' git config user.name github-actions - git config user.email <> + git config user.email "<>" git pull git checkout -b "$t_branch" origin/master git add '${{ matrix.channel }}' From 821454cda858f5ffbe0bbc4d5b5c8504b8b9269e Mon Sep 17 00:00:00 2001 From: Martin Ruckli Date: Sun, 5 Nov 2023 23:02:13 +0100 Subject: [PATCH 4/4] adds back the channel context --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5f1c715f..5e91b39c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -46,7 +46,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: - context: . + context: ${{ steps.channel.outputs.channel }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}