Skip to content

Publish ACA-Py 1.5.1rc0 Image #118

Publish ACA-Py 1.5.1rc0 Image

Publish ACA-Py 1.5.1rc0 Image #118

Workflow file for this run

name: Publish ACA-Py Image
run-name: Publish ACA-Py ${{ inputs.tag || github.event.release.tag_name }} Image
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: Image tag
required: true
type: string
ref:
description: Optional - The branch, tag or SHA to checkout.
required: false
type: string
workflow_call:
inputs:
tag:
required: true
type: string
ref:
required: false
type: string
permissions:
contents: read
jobs:
build-image:
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
arch: ["amd64", "arm64"]
include:
- arch: amd64
runs-on: ubuntu-24.04
- arch: arm64
runs-on: ubuntu-24.04-arm
name: Build ACA-Py Image
runs-on: ${{ matrix.runs-on }}
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
ref: ${{ inputs.ref || '' }}
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
with:
cache-binary: false
install: true
version: latest
- name: Build and Cache Image
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
push: false
context: .
file: docker/Dockerfile
build-args: |
python_version=${{ matrix.python-version }}
acapy_version=${{ inputs.tag || github.event.release.tag_name }}
cache-from: type=gha,scope=acapy-agent-${{ matrix.arch }}
cache-to: type=gha,scope=acapy-agent-${{ matrix.arch }},mode=max
platforms: linux/${{ matrix.arch }}
publish-images:
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
image-type: ["standard", "bbs"]
include:
- image-type: standard
image-name: acapy-agent
# linux/386 platform support has been disabled pending a permanent fix for https://github.com/openwallet-foundation/acapy/issues/2124
# platforms: linux/amd64,linux/arm64,linux/386
platforms: linux/amd64,linux/arm64
acapy-reqs: ""
- image-type: bbs
image-name: acapy-agent-bbs
# Because of BBS, only linux/amd64 is supported for the extended image
# https://github.com/openwallet-foundation/acapy/issues/2124#issuecomment-2293569659
platforms: linux/amd64
acapy-reqs: "[askar,bbs,didcommv2]"
name: Publish ACA-Py ${{ matrix.image-type == 'bbs' && 'BBS ' || '' }} Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: build-image
steps:
- name: Checkout Code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
ref: ${{ inputs.ref || '' }}
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
with:
cache-binary: false
install: true
version: latest
- name: Log in to the GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Ensure the repo owner is lowercase for the image name
- name: Lowercase Repo Owner
id: lower
run: echo "owner=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT
- name: Check if Highest Semantic Version
id: check_latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURRENT_TAG: ${{ inputs.tag || github.event.release.tag_name }}
run: |
# Skip if this is an RC release
if [[ "$CURRENT_TAG" =~ rc ]]; then
echo "is_latest=false" >> "$GITHUB_OUTPUT"
echo "Skipping latest tag for RC release"
exit 0
fi
# Get all non-RC release tags and sort by semantic version
HIGHEST_TAG=$(gh api /repos/${{ github.repository }}/releases --paginate \
| jq -r '[.[] | select(.prerelease == false and (.tag_name | test("rc") | not)) | .tag_name] | .[]' \
| sort -V | tail -1)
echo "Current tag: $CURRENT_TAG"
echo "Highest semantic version: $HIGHEST_TAG"
if [ "$CURRENT_TAG" == "$HIGHEST_TAG" ]; then
echo "is_latest=true" >> "$GITHUB_OUTPUT"
echo "This is the highest semantic version - will tag as latest"
else
echo "is_latest=false" >> "$GITHUB_OUTPUT"
echo "Not the highest semantic version - skipping latest tag"
fi
- name: Setup Image Metadata
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: |
ghcr.io/${{ steps.lower.outputs.owner }}/${{ matrix.image-name }}
tags: |
type=raw,value=py${{ matrix.python-version }}-${{ inputs.tag || github.event.release.tag_name }}
type=semver,pattern={{version}},value=${{ inputs.tag || github.event.release.tag_name }}
type=semver,pattern={{major}}.{{minor}},value=${{ inputs.tag || github.event.release.tag_name }},enable=${{ !contains(github.event.release.tag_name || inputs.tag, 'rc') }}
type=raw,value=latest,enable=${{ steps.check_latest.outputs.is_latest == 'true' }}
- name: Publish Image to GHCR.io
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
push: true
context: .
file: docker/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
python_version=${{ matrix.python-version }}
acapy_version=${{ inputs.tag || github.event.release.tag_name }}
${{ matrix.image-type == 'bbs' && 'acapy_name=acapy-agent-bbs' || '' }}
${{ matrix.acapy-reqs != '' && format('acapy_reqs={0}', matrix.acapy-reqs) || '' }}
cache-from: |
${{ matrix.image-type == 'standard' && 'type=gha,scope=acapy-agent-arm64' || '' }}
${{ matrix.image-type == 'standard' && 'type=gha,scope=acapy-agent-amd64' || '' }}
${{ matrix.image-type == 'bbs' && 'type=gha,scope=acapy-agent-bbs' || ''}}
cache-to: ${{ matrix.image-type == 'bbs' && 'type=gha,scope=acapy-agent-bbs,mode=max' || '' }}
platforms: ${{ matrix.platforms }}