Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ permissions:
contents: read
packages: write

env:
IMAGE: ghcr.io/${{ github.repository_owner }}/agent

jobs:
build:
name: Build ${{ matrix.platform }}
Expand All @@ -38,11 +35,12 @@ jobs:
matrix:
platform: [ linux/amd64, linux/arm64 ]
steps:
- name: Prepare arch vars
- name: Prepare vars
id: prep
run: |
ARCH="${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}"
echo "arch=$ARCH" >> "$GITHUB_OUTPUT"
echo "image=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/agent" >> "$GITHUB_OUTPUT"

- name: Checkout
uses: actions/checkout@v4
Expand All @@ -69,7 +67,7 @@ jobs:
platforms: ${{ matrix.platform }}
target: ${{ inputs.target }}
provenance: false
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
outputs: type=image,name=${{ steps.prep.outputs.image }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=ghcr-${{ steps.prep.outputs.arch }}
cache-to: type=gha,mode=max,scope=ghcr-${{ steps.prep.outputs.arch }},ignore-error=true

Expand All @@ -93,6 +91,10 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- name: Prepare vars
id: prep
run: echo "image=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/agent" >> "$GITHUB_OUTPUT"

- name: Download digests
uses: actions/download-artifact@v4
with:
Expand All @@ -114,7 +116,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
images: ${{ steps.prep.outputs.image }}
tags: |
type=semver,pattern={{version}},value=${{ inputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ inputs.version }}
Expand All @@ -126,7 +128,7 @@ jobs:
run: |
docker buildx imagetools create \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
$(printf '${{ steps.prep.outputs.image }}@sha256:%s ' *)

- name: Inspect
run: docker buildx imagetools inspect ${{ env.IMAGE }}:${{ inputs.version }}
run: docker buildx imagetools inspect ${{ steps.prep.outputs.image }}:${{ inputs.version }}
Loading