From 30b9d20627aabfab0ff81474260e4f60cbcb22f8 Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Tue, 12 Aug 2025 16:04:44 -0700 Subject: [PATCH] add ghcr publish --- .github/workflows/ghrc-push-main.yml | 1 - .github/workflows/ghrc-push-release.yml | 87 +++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ghrc-push-release.yml diff --git a/.github/workflows/ghrc-push-main.yml b/.github/workflows/ghrc-push-main.yml index 2553be97..4d3f6bd8 100644 --- a/.github/workflows/ghrc-push-main.yml +++ b/.github/workflows/ghrc-push-main.yml @@ -6,7 +6,6 @@ env: on: push: branches: [main] - pull_request: jobs: build-arm64: diff --git a/.github/workflows/ghrc-push-release.yml b/.github/workflows/ghrc-push-release.yml new file mode 100644 index 00000000..35d5de92 --- /dev/null +++ b/.github/workflows/ghrc-push-release.yml @@ -0,0 +1,87 @@ +name: release - publish docker image to ghcr (latest) + +env: + IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/archgw + +on: + release: + types: [published] + +jobs: + build-arm64: + runs-on: [linux-arm64] + permissions: { contents: read, packages: write } + steps: + - uses: actions/checkout@v4 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=raw,value={{tag}} + + - name: Build and Push ARM64 Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./arch/Dockerfile + platforms: linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }}-arm64 + + build-amd64: + runs-on: ubuntu-latest + permissions: { contents: read, packages: write } + steps: + - uses: actions/checkout@v4 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=raw,value={{tag}} + + - name: Build and Push AMD64 Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./arch/Dockerfile + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }}-amd64 + + create-manifest: + runs-on: ubuntu-latest + needs: [build-arm64, build-amd64] + permissions: { contents: read, packages: write } + steps: + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=raw,value={{tag}} + + - name: Create Multi-Arch Manifest + run: | + docker buildx imagetools create -t ${{ steps.meta.outputs.tags }} \ + ${{ steps.meta.outputs.tags }}-arm64 \ + ${{ steps.meta.outputs.tags }}-amd64