🚸 chore: Update docker-publish workflow to use GHCR repository variable
This commit is contained in:
parent
7330c45c76
commit
5fe72fe29f
1 changed files with 12 additions and 11 deletions
23
.github/workflows/docker-publish.yml
vendored
23
.github/workflows/docker-publish.yml
vendored
|
|
@ -4,11 +4,12 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- "dev"
|
- "dev"
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [ published ]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
GHCR_REPO: ghcr.io/${{ github.repository }}
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -24,7 +25,7 @@ jobs:
|
||||||
- runner: ubuntu-latest
|
- runner: ubuntu-latest
|
||||||
platform: linux/amd64
|
platform: linux/amd64
|
||||||
platform_tag: linux-amd64
|
platform_tag: linux-amd64
|
||||||
- runner: [self-hosted, linux, ARM64]
|
- runner: [ self-hosted, linux, ARM64 ]
|
||||||
platform: linux/arm64
|
platform: linux/arm64
|
||||||
platform_tag: linux-arm64
|
platform_tag: linux-arm64
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -49,7 +50,7 @@ jobs:
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5.5.1
|
uses: docker/metadata-action@v5.5.1
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.GHCR_REPO }}
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-') }}
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-') }}
|
||||||
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
|
@ -62,21 +63,21 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
|
outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true
|
||||||
cache-from: type=gha,scope=build-${{ matrix.platform_tag }}
|
cache-from: type=gha,scope=build-${{ matrix.platform_tag }}
|
||||||
cache-to: type=gha,scope=build-${{ matrix.platform_tag }},mode=max
|
cache-to: type=gha,scope=build-${{ matrix.platform_tag }},mode=max
|
||||||
|
|
||||||
- name: Export digest
|
- name: Export digest
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/digests
|
mkdir -p ${{ runner.temp }}/digests
|
||||||
digest="${{ steps.build-and-push.outputs.digest }}"
|
digest="${{ steps.build-and-push.outputs.digest }}"
|
||||||
touch "/tmp/digests/${digest#sha256:}"
|
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
||||||
|
|
||||||
- name: Upload digest
|
- name: Upload digest
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: digests-${{ matrix.platform_tag }}
|
name: digests-${{ matrix.platform_tag }}
|
||||||
path: /tmp/digests/*
|
path: ${{ runner.temp }}/digests/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
|
|
@ -87,7 +88,7 @@ jobs:
|
||||||
- name: Download digests
|
- name: Download digests
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: /tmp/digests
|
path: ${{ runner.temp }}/digests
|
||||||
pattern: digests-*
|
pattern: digests-*
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
|
|
@ -112,11 +113,11 @@ jobs:
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
|
|
||||||
- name: Create manifest list and push
|
- name: Create manifest list and push
|
||||||
working-directory: /tmp/digests
|
working-directory: ${{ runner.temp }}/digests
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
||||||
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
|
$(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)
|
||||||
|
|
||||||
- name: Inspect image
|
- name: Inspect image
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
|
docker buildx imagetools inspect ${{ env.GHCR_REPO }}:${{ steps.meta.outputs.version }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue