Skip to content

Commit d60fbf4

Browse files
committed
Release waits for tests
Change implementation (reverting 1c0e38a), as current one generates one skipped run for each main run, that is effectively cluttering the list of runs for this workflow.
1 parent 7f790d8 commit d60fbf4

1 file changed

Lines changed: 13 additions & 40 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,27 @@
22
name: Release
33

44
on:
5-
workflow_run:
6-
workflows:
7-
- "CI"
8-
types:
9-
- completed
5+
push:
6+
tags:
7+
- v*.*.*
108

119
jobs:
12-
validate-tag:
13-
name: Check tag
10+
wait-for-ci:
11+
name: Wait for CI
1412
runs-on: ubuntu-latest
15-
outputs:
16-
valid_tag: ${{ steps.validation.outputs.valid_tag }}
17-
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && startsWith(github.event.workflow_run.head_branch, 'v') }}
1813
steps:
19-
- name: Check out the repository including tags
20-
uses: actions/checkout@v6
14+
- name: Wait for CI to pass
15+
uses: lewagon/wait-on-check-action@v1.5.0
2116
with:
22-
ref: ${{ github.event.workflow_run.head_sha }}
23-
fetch-depth: 0
24-
fetch-tags: true
25-
- name: Validate tag
26-
id: validation
27-
run: |
28-
# Validation is necessary in the unlikely case that a branch matching the tag naming pattern is pushed
29-
# and the CI workflow in that branch is modified to run upon a push to that branch
30-
REF='${{ github.event.workflow_run.head_branch }}' # This can be a branch or tag name
31-
if [[ "$REF" != v*.*.* ]]; then
32-
echo "valid_tag=false" >> "$GITHUB_OUTPUT"; exit 0
33-
fi
34-
# Validate that the tag exists
35-
if ! git rev-parse -q --verify "refs/tags/$REF" >/dev/null; then
36-
echo "There is no tag matching $REF - $REF is a branch"
37-
echo "valid_tag=false" >> "$GITHUB_OUTPUT"; exit 0
38-
fi
39-
# Validate that the tag is for the same commit that was pushed
40-
TAG_SHA="$(git rev-parse "$REF^{commit}")"
41-
COMMIT_SHA="${{ github.event.workflow_run.head_sha }}"
42-
if [ "$TAG_SHA" != "$COMMIT_SHA" ]; then
43-
echo "Tag SHA $TAG_SHA does not match pushed commit SHA $COMMIT_SHA"
44-
echo "valid_tag=false" >> "$GITHUB_OUTPUT"; exit 0
45-
fi
46-
echo "Tag $REF exists and is valid. Tag $TAG_SHA matches the pushed commit $COMMIT_SHA."
47-
echo "valid_tag=true" >> "$GITHUB_OUTPUT"
17+
ref: ${{ github.sha }}
18+
running-workflow-name: Wait for CI
19+
repo-token: ${{ secrets.GITHUB_TOKEN }}
20+
wait-interval: 10
21+
4822
publish:
4923
name: Publish to PyPI
50-
needs: validate-tag
24+
needs: wait-for-ci
5125
runs-on: ubuntu-latest
52-
if: ${{ needs.validate-tag.outputs.valid_tag == 'true' && github.event.workflow_run.conclusion == 'success' }}
5326
steps:
5427
- uses: actions/checkout@v6
5528

0 commit comments

Comments
 (0)