From 9dc72183f368b76d6950de82072a93e05112e3dc Mon Sep 17 00:00:00 2001 From: RT <13197246+slikie@users.noreply.github.com> Date: Sun, 30 Jun 2024 15:37:17 +0800 Subject: [PATCH 1/6] test build arm64 build. --- .github/workflows/go.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index fe95ab1..ad08025 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -90,6 +90,7 @@ jobs: with: cache-from: ${{ env.GHCR_REGISTRY_IMAGE }}:latest pull: true + platforms: linux/amd64,linux/arm64 file: docker/Dockerfile tags: ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }} push: true From 81f4bb7949cd26c71e2891a223208736ee0d61e6 Mon Sep 17 00:00:00 2001 From: RT <13197246+slikie@users.noreply.github.com> Date: Sun, 30 Jun 2024 16:27:39 +0800 Subject: [PATCH 2/6] stratagizing deployment in building - the retag workflow seems to not able to handle multi-arch images properly --- .github/workflows/go.yaml | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index ad08025..a2eebb0 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -85,6 +85,15 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract Docker metadata + id: metadata + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=semver,pattern={{version}} + - name: Docker Build uses: docker/build-push-action@v5 with: @@ -92,24 +101,8 @@ jobs: pull: true platforms: linux/amd64,linux/arm64 file: docker/Dockerfile - tags: ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }} + tags: ${{ steps.metadata.outputs.tags }} + labels: ${{ steps.metadata.outputs.labels }} push: true build-args: | COMMIT_HASH=${{ github.sha }} - - deploy-docker: - runs-on: ubuntu-latest - needs: - - build-docker - if: github.ref == 'refs/heads/main' - steps: - - name: Login to registry - uses: docker/login-action@v3 - with: - registry: ${{ env.GHCR_REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - uses: beeper/docker-retag-push-latest@main - with: - image: ${{ env.GHCR_REGISTRY_IMAGE }} From 26579e7c9c22441347e6f84a87c93e7d10bd61cc Mon Sep 17 00:00:00 2001 From: RT <13197246+slikie@users.noreply.github.com> Date: Sun, 30 Jun 2024 16:56:07 +0800 Subject: [PATCH 3/6] try to fix tag the commit sha --- .github/workflows/go.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index a2eebb0..020624d 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -92,7 +92,8 @@ jobs: images: ghcr.io/${{ github.repository }} tags: | type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} - type=semver,pattern={{version}} + type=sha,format=long + type=ref - name: Docker Build uses: docker/build-push-action@v5 From 84499f85b081e1f883c8ec951375f2545383415b Mon Sep 17 00:00:00 2001 From: RT <13197246+slikie@users.noreply.github.com> Date: Sun, 30 Jun 2024 16:59:02 +0800 Subject: [PATCH 4/6] fixup --- .github/workflows/go.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 020624d..fa33820 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -93,7 +93,6 @@ jobs: tags: | type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} type=sha,format=long - type=ref - name: Docker Build uses: docker/build-push-action@v5 From 255b35b3c90ae53d3f657fd16813cebebbe36513 Mon Sep 17 00:00:00 2001 From: RT <13197246+slikie@users.noreply.github.com> Date: Sun, 30 Jun 2024 17:04:24 +0800 Subject: [PATCH 5/6] optimize output --- .github/workflows/go.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index fa33820..868a71b 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -92,7 +92,7 @@ jobs: images: ghcr.io/${{ github.repository }} tags: | type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} - type=sha,format=long + type=sha,format=long,prefix= - name: Docker Build uses: docker/build-push-action@v5 From 553384795ea539eff2e870075e313a4369d0ee17 Mon Sep 17 00:00:00 2001 From: slikie <13197246+slikie@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:58:26 +0800 Subject: [PATCH 6/6] Update .github/workflows/go.yaml Co-authored-by: Patrick Evans <31580846+holysoles@users.noreply.github.com> --- .github/workflows/go.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 868a71b..773b7e0 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -91,7 +91,7 @@ jobs: with: images: ghcr.io/${{ github.repository }} tags: | - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=raw,value=latest,enable={{is_default_branch}} type=sha,format=long,prefix= - name: Docker Build