Skip to content

Release 0.9.0a5 by @sevein #30

Release 0.9.0a5 by @sevein

Release 0.9.0a5 by @sevein #30

Workflow file for this run

name: Release
run-name: Release ${{ inputs.version }} by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
version:
description: "PEP 440 version to release (e.g., 1.2.3, 1.2.3a1 or 1.2.3rc1)"
required: true
type: string
concurrency:
group: release-${{ github.event.inputs.version }}
cancel-in-progress: true
env:
REGISTRY_IMAGE: artefactual/aipscan
jobs:
validate-version:
name: Validate release version
runs-on: ubuntu-24.04
outputs:
is-prerelease: ${{ steps.validate.outputs.is-prerelease }}
steps:
- name: Check out the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
sparse-checkout: .github/actions/validate-pep440-version
- name: Validate PEP 440 version
id: validate
uses: ./.github/actions/validate-pep440-version
with:
version: ${{ github.event.inputs.version }}
build:
name: Build Python packages
runs-on: ubuntu-24.04
needs: validate-version
steps:
- name: Check out the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Create local release tag
run: git tag ${{ github.event.inputs.version }}
- name: Install Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version-file: .node-version
- name: Install uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
with:
enable-cache: true
version: latest
- name: Build package
run: uv build
- name: Save distribution directory
uses: actions/upload-artifact@2848b2cda0e5190984587ec6bb1f36730ca78d50 # v4.6.2
with:
# We expect:
# - dist/aipscan-[version].tar.gz
# - dist/aipscan-[version]-py3-none-any.whl
name: dist
path: dist
pypi:
name: Publish Python packages
runs-on: ubuntu-24.04
needs: build
environment: pypi
permissions:
id-token: write
steps:
- name: Restore distribution directory
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: dist
path: dist
- name: Upload distribution packages to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
tag:
name: Push tag
runs-on: ubuntu-24.04
needs: pypi
permissions:
contents: write
steps:
- name: Check out the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Push release tag
run: |
git tag ${{ github.event.inputs.version }}
git push origin refs/tags/${{ github.event.inputs.version }}
image-build:
name: Build Docker images
needs: tag
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
runner: ubuntu-24.04
- platform: linux/arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- name: Check out repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Read Python version
id: python-version
run: |
python_version="$(tr -d '\n' < .python-version)"
echo "value=${python_version}" >> "$GITHUB_OUTPUT"
- name: Restore distribution directory
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: dist
path: dist
- name: Login to Docker Hub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Derive platform pair
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
- name: Docker meta
id: meta
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ env.REGISTRY_IMAGE }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
target: release
build-args: |
PYTHON_VERSION=${{ steps.python-version.outputs.value }}
WHEEL=aipscan-${{ github.event.inputs.version }}-py3-none-any.whl
- name: Export digest
run: |
mkdir -p "${{ runner.temp }}/digests"
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 # v4.6.2
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
image-merge:
name: Publish Docker manifests
runs-on: ubuntu-24.04
needs: [image-build, validate-version]
steps:
- name: Download digests
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true
- name: Login to Docker Hub
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Docker meta
id: meta
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
${{ github.event.inputs.version }}
${{ needs.validate-version.outputs.is-prerelease == 'true' && 'pre' || 'latest' }}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ github.event.inputs.version }}
release:
name: Create GitHub release
runs-on: ubuntu-24.04
needs: [image-merge, validate-version]
permissions:
contents: write
steps:
- name: Check out the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
fetch-tags: true
- name: Create GitHub Release
uses: ./.github/actions/release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ github.event.inputs.version }}
title: ${{ github.event.inputs.version }}
prerelease: ${{ needs.validate-version.outputs.is-prerelease }}