diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml index 831a2e7..2787710 100644 --- a/.github/workflows/ghcr.yml +++ b/.github/workflows/ghcr.yml @@ -27,15 +27,80 @@ permissions: packages: write jobs: - publish: - name: Build and push to GHCR - runs-on: ubuntu-latest + build: + name: Build ${{ matrix.platform }} + runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'ubuntu-24.04-arm' }} + strategy: + fail-fast: false + matrix: + platform: [ linux/amd64, linux/arm64 ] steps: + - 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 with: ref: ${{ inputs.ref }} - fetch-depth: 0 + fetch-depth: 1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push by digest + id: build + uses: docker/build-push-action@v6 + with: + context: . + file: ${{ inputs.dockerfile }} + platforms: ${{ matrix.platform }} + target: ${{ inputs.target }} + provenance: false + 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 + + - name: Export digest + env: + DIGEST: ${{ steps.build.outputs.digest }} + run: | + mkdir -p /tmp/digests + touch "/tmp/digests/${DIGEST#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digest-${{ steps.prep.outputs.arch }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + name: Create multi-arch manifest + 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: + path: /tmp/digests + pattern: digest-* + merge-multiple: true - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -51,22 +116,19 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/agent + images: ${{ steps.prep.outputs.image }} tags: | type=semver,pattern={{version}},value=${{ inputs.version }} type=semver,pattern={{major}}.{{minor}},value=${{ inputs.version }} type=semver,pattern={{major}},value=${{ inputs.version }} type=raw,value=latest,enable=${{ inputs.add_latest }} - - name: Build and push image - uses: docker/build-push-action@v6 - with: - context: . - file: ${{ inputs.dockerfile }} - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - target: ${{ inputs.target }} - provenance: false - cache-from: type=gha,scope=ghcr-build - cache-to: type=gha,mode=max,scope=ghcr-build,ignore-error=true + - name: Create and push manifest list + working-directory: /tmp/digests + run: | + docker buildx imagetools create \ + $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ steps.prep.outputs.image }}@sha256:%s ' *) + + - name: Inspect + run: docker buildx imagetools inspect ${{ steps.prep.outputs.image }}:${{ inputs.version }} diff --git a/CITATION.cff b/CITATION.cff index 8508db5..1d2d617 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -27,5 +27,5 @@ keywords: - self-hosted - portabase license: Apache-2.0 -version: 1.17.1 +version: 1.18.2 date-released: '2026-02-24' diff --git a/Cargo.lock b/Cargo.lock index 341a91a..1e24164 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3503,7 +3503,7 @@ dependencies = [ [[package]] name = "portabase-agent" -version = "1.17.1" +version = "1.18.2" dependencies = [ "aes", "aes-gcm", diff --git a/Cargo.toml b/Cargo.toml index 9b362f6..ecc99b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "portabase-agent" -version = "1.17.1" +version = "1.18.2" edition = "2024" [dependencies]