From 3e85e073635015df521b406c281cb55fa97e3c1d Mon Sep 17 00:00:00 2001 From: Linus Rath Date: Fri, 10 Apr 2026 14:46:04 +0200 Subject: [PATCH] feat: separate branch containers into beta and dev packages --- .github/workflows/docker-publish.yml | 30 +++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 1af541b6..43114ea9 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -21,11 +21,23 @@ on: - ".github/workflows/docker-publish.yml" workflow_dispatch: -env: - IMAGE_NAME: ghcr.io/${{ github.repository }}-${{ github.ref_name }} - jobs: + prepare: + runs-on: ubuntu-latest + outputs: + image_name: ${{ steps.set.outputs.image_name }} + steps: + - name: Set image name + id: set + run: | + if [ "${{ github.ref_name }}" = "main" ]; then + echo "image_name=ghcr.io/${{ github.repository }}-beta" >> $GITHUB_OUTPUT + else + echo "image_name=ghcr.io/${{ github.repository }}-${{ github.ref_name }}" >> $GITHUB_OUTPUT + fi + build: + needs: prepare strategy: fail-fast: false matrix: @@ -57,7 +69,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.IMAGE_NAME }} + images: ${{ needs.prepare.outputs.image_name }} - name: Build and push by digest id: build @@ -66,7 +78,7 @@ jobs: context: . platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true + outputs: type=image,name=${{ needs.prepare.outputs.image_name }},push-by-digest=true,name-canonical=true,push=true cache-from: type=gha,scope=${{ matrix.platform }} cache-to: type=gha,mode=max,scope=${{ matrix.platform }} @@ -86,7 +98,7 @@ jobs: merge: runs-on: ubuntu-latest - needs: build + needs: [prepare, build] permissions: contents: read packages: write @@ -113,7 +125,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.IMAGE_NAME }} + images: ${{ needs.prepare.outputs.image_name }} tags: | type=raw,value=latest type=sha @@ -122,8 +134,8 @@ jobs: working-directory: /tmp/digests run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) + $(printf '${{ needs.prepare.outputs.image_name }}@sha256:%s ' *) - name: Inspect image run: | - docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} + docker buildx imagetools inspect ${{ needs.prepare.outputs.image_name }}:${{ steps.meta.outputs.version }}