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
71 changes: 51 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ name: Release
on: workflow_dispatch

jobs:
build:
name: Publish a release
release:
name: Create release
runs-on: ubuntu-latest

# Specifying an environment is strongly recommended by PyPI.
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
environment: release

permissions:
# This is needed for PyPI publishing.
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
id-token: write
# This is needed for https://github.com/stefanzweifel/git-auto-commit-action.
contents: write

outputs:
version: ${{ steps.calver.outputs.release }}
tag: ${{ steps.tag_version.outputs.new_tag }}

steps:
- uses: actions/checkout@v6
with:
Expand All @@ -36,12 +33,6 @@ jobs:
# The default GITHUB_TOKEN cannot bypass rulesets.
token: ${{ secrets.RELEASE_PAT }}

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: '**/pyproject.toml'

- name: Calver calculate version
uses: StephaneBour/actions-calver@master
id: calver
Expand Down Expand Up @@ -102,10 +93,37 @@ jobs:
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}

pypi:
name: Publish to PyPI
needs: release
runs-on: ubuntu-latest

# Specifying an environment is strongly recommended by PyPI.
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
environment: release

permissions:
# This is needed for PyPI publishing.
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
id-token: write

steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.release.outputs.tag }}
# Fetch all history including tags.
# Needed for setuptools-scm version detection.
fetch-depth: 0
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: '**/pyproject.toml'

- name: Build a binary wheel and a source tarball
run: |
git fetch --tags
git checkout ${{ steps.tag_version.outputs.new_tag }}
uv build --sdist --wheel --out-dir dist/
uv run --extra=release check-wheel-contents dist/*.whl

Expand All @@ -116,6 +134,19 @@ jobs:
with:
verbose: true

docker:
name: Publish Docker images
needs: release
runs-on: ubuntu-latest

permissions: {}

steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.release.outputs.tag }}
persist-credentials: false

- name: Login to DockerHub
uses: docker/login-action@v3
with:
Expand All @@ -137,7 +168,7 @@ jobs:
target: target-manager
tags: |
adamtheturtle/vuforia-target-manager-mock:latest
adamtheturtle/vuforia-target-manager-mock:${{ steps.calver.outputs.release }}
adamtheturtle/vuforia-target-manager-mock:${{ needs.release.outputs.version }}

- name: Build and push VWS Docker image
uses: docker/build-push-action@v6.19.2
Expand All @@ -148,7 +179,7 @@ jobs:
target: vws
tags: |
adamtheturtle/vuforia-vws-mock:latest
adamtheturtle/vuforia-vws-mock:${{ steps.calver.outputs.release }}
adamtheturtle/vuforia-vws-mock:${{ needs.release.outputs.version }}

- name: Build and push VWQ Docker image
uses: docker/build-push-action@v6.19.2
Expand All @@ -159,4 +190,4 @@ jobs:
target: vwq
tags: |-
adamtheturtle/vuforia-vwq-mock:latest
adamtheturtle/vuforia-vwq-mock:${{ steps.calver.outputs.release }}
adamtheturtle/vuforia-vwq-mock:${{ needs.release.outputs.version }}
Loading