Skip to content

Commit a5f6354

Browse files
Merge pull request #2914 from VWS-Python/parallelize-release-workflow
Parallelize release workflow
2 parents 4877930 + 4e0a8e8 commit a5f6354

File tree

1 file changed

+51
-20
lines changed

1 file changed

+51
-20
lines changed

.github/workflows/release.yml

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@ name: Release
44
on: workflow_dispatch
55

66
jobs:
7-
build:
8-
name: Publish a release
7+
release:
8+
name: Create release
99
runs-on: ubuntu-latest
1010

11-
# Specifying an environment is strongly recommended by PyPI.
12-
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
13-
environment: release
14-
1511
permissions:
16-
# This is needed for PyPI publishing.
17-
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
18-
id-token: write
1912
# This is needed for https://github.com/stefanzweifel/git-auto-commit-action.
2013
contents: write
2114

15+
outputs:
16+
version: ${{ steps.calver.outputs.release }}
17+
tag: ${{ steps.tag_version.outputs.new_tag }}
18+
2219
steps:
2320
- uses: actions/checkout@v6
2421
with:
@@ -36,12 +33,6 @@ jobs:
3633
# The default GITHUB_TOKEN cannot bypass rulesets.
3734
token: ${{ secrets.RELEASE_PAT }}
3835

39-
- name: Install uv
40-
uses: astral-sh/setup-uv@v7
41-
with:
42-
enable-cache: true
43-
cache-dependency-glob: '**/pyproject.toml'
44-
4536
- name: Calver calculate version
4637
uses: StephaneBour/actions-calver@master
4738
id: calver
@@ -102,10 +93,37 @@ jobs:
10293
name: Release ${{ steps.tag_version.outputs.new_tag }}
10394
body: ${{ steps.tag_version.outputs.changelog }}
10495

96+
pypi:
97+
name: Publish to PyPI
98+
needs: release
99+
runs-on: ubuntu-latest
100+
101+
# Specifying an environment is strongly recommended by PyPI.
102+
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
103+
environment: release
104+
105+
permissions:
106+
# This is needed for PyPI publishing.
107+
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
108+
id-token: write
109+
110+
steps:
111+
- uses: actions/checkout@v6
112+
with:
113+
ref: ${{ needs.release.outputs.tag }}
114+
# Fetch all history including tags.
115+
# Needed for setuptools-scm version detection.
116+
fetch-depth: 0
117+
persist-credentials: false
118+
119+
- name: Install uv
120+
uses: astral-sh/setup-uv@v7
121+
with:
122+
enable-cache: true
123+
cache-dependency-glob: '**/pyproject.toml'
124+
105125
- name: Build a binary wheel and a source tarball
106126
run: |
107-
git fetch --tags
108-
git checkout ${{ steps.tag_version.outputs.new_tag }}
109127
uv build --sdist --wheel --out-dir dist/
110128
uv run --extra=release check-wheel-contents dist/*.whl
111129
@@ -116,6 +134,19 @@ jobs:
116134
with:
117135
verbose: true
118136

137+
docker:
138+
name: Publish Docker images
139+
needs: release
140+
runs-on: ubuntu-latest
141+
142+
permissions: {}
143+
144+
steps:
145+
- uses: actions/checkout@v6
146+
with:
147+
ref: ${{ needs.release.outputs.tag }}
148+
persist-credentials: false
149+
119150
- name: Login to DockerHub
120151
uses: docker/login-action@v3
121152
with:
@@ -137,7 +168,7 @@ jobs:
137168
target: target-manager
138169
tags: |
139170
adamtheturtle/vuforia-target-manager-mock:latest
140-
adamtheturtle/vuforia-target-manager-mock:${{ steps.calver.outputs.release }}
171+
adamtheturtle/vuforia-target-manager-mock:${{ needs.release.outputs.version }}
141172
142173
- name: Build and push VWS Docker image
143174
uses: docker/build-push-action@v6.19.2
@@ -148,7 +179,7 @@ jobs:
148179
target: vws
149180
tags: |
150181
adamtheturtle/vuforia-vws-mock:latest
151-
adamtheturtle/vuforia-vws-mock:${{ steps.calver.outputs.release }}
182+
adamtheturtle/vuforia-vws-mock:${{ needs.release.outputs.version }}
152183
153184
- name: Build and push VWQ Docker image
154185
uses: docker/build-push-action@v6.19.2
@@ -159,4 +190,4 @@ jobs:
159190
target: vwq
160191
tags: |-
161192
adamtheturtle/vuforia-vwq-mock:latest
162-
adamtheturtle/vuforia-vwq-mock:${{ steps.calver.outputs.release }}
193+
adamtheturtle/vuforia-vwq-mock:${{ needs.release.outputs.version }}

0 commit comments

Comments
 (0)