Skip to content

Commit 37d816c

Browse files
authored
refactor: maturin.yml (#20)
* change: get tag from tree instead of github.ref * remove: job if condition * add: run maturin workflow after psl update * change: move tag checking in its own job
1 parent 4dd63a8 commit 37d816c

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

.github/workflows/maturin.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
- "*"
1717
pull_request:
1818
workflow_dispatch:
19+
workflow_run:
20+
workflows: [Weekly PSL Update and Patch Release]
21+
types: [completed]
1922

2023
permissions:
2124
contents: read
@@ -232,11 +235,34 @@ jobs:
232235
name: wheels-sdist
233236
path: dist
234237

238+
check-tag:
239+
name: Check for pyfaup-rs tag
240+
runs-on: ubuntu-latest
241+
needs: [linux, musllinux, windows, macos, sdist]
242+
outputs:
243+
has_pyfaup_tag: ${{ steps.check-tag.outputs.has_pyfaup_tag }}
244+
steps:
245+
- uses: actions/checkout@v6
246+
with:
247+
fetch-depth: 0
248+
- name: Check for pyfaup-rs tag
249+
id: check-tag
250+
run: |
251+
set -euxo pipefail
252+
# Get all tags for the current commit
253+
tags=$(git tag --points-at HEAD)
254+
# Check if any tag matches pyfaup-rs-v* pattern
255+
if echo "$tags" | grep -qE '^pyfaup-rs-v'; then
256+
echo "has_pyfaup_tag=true" >> $GITHUB_OUTPUT
257+
else
258+
echo "has_pyfaup_tag=false" >> $GITHUB_OUTPUT
259+
fi
260+
235261
release:
236262
name: Release
237263
runs-on: ubuntu-latest
238-
if: ${{ startsWith(github.ref, 'refs/tags/pyfaup-rs-v') || github.event_name == 'workflow_dispatch' }}
239-
needs: [linux, musllinux, windows, macos, sdist]
264+
needs: [check-tag]
265+
if: needs.check-tag.outputs.has_pyfaup_tag == 'true'
240266
permissions:
241267
# Use to sign the release artifacts
242268
id-token: write
@@ -252,8 +278,6 @@ jobs:
252278
with:
253279
subject-path: "wheels-*/*"
254280
- name: Install uv
255-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
256281
uses: astral-sh/setup-uv@v7
257282
- name: Publish to PyPI
258-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
259283
run: uv publish 'wheels-*/*'

0 commit comments

Comments
 (0)