Skip to content

Commit 7c6ad93

Browse files
Flesh out the workflow
1 parent 37119b8 commit 7c6ad93

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
name: Create a dvsim release
66
on:
77
push:
8+
branches:
9+
# Branch-protected, only reviewed pull-requests push to master
10+
- "master"
11+
# [DEV] Pushes to the following branch during action-development only
12+
- "semantic-release-dev"
13+
pull_request:
14+
types:
15+
# Run at the point pull_requests are closed, but only if pull_request.merged == true.
16+
- closed
817

918
permissions:
1019
contents: read
@@ -15,16 +24,21 @@ permissions:
1524
jobs:
1625
release:
1726
name: Tag a new semantic-release, upload src+dist assets as GitHub release
27+
# [DEV] Any on-event to the 'semantic-release-dev' ref is accepted during action-development only
28+
if: ${{ github.event.pull_request.merged == true || github.ref == 'refs/heads/semantic-release-dev' }}
1829
runs-on: ubuntu-latest
1930
permissions:
2031
# Push release commit / tag, upload github release artifacts
2132
contents: write
22-
2333
# The concurrency directive is used on the job to prevent race conditions of more than one release job
2434
# in the case if there are multiple pushes to main in a short period of time.
2535
concurrency:
2636
group: ${{ github.workflow }}-release-${{ github.ref_name }}
2737
cancel-in-progress: false
38+
outputs:
39+
# Forward the 'released' output from 'semantic-release version' so that subsequent jobs
40+
# can be conditionally run only if a new released has actually been generated.
41+
released: ${{ steps.version_release.outputs.released }}
2842

2943
steps:
3044

@@ -61,6 +75,8 @@ jobs:
6175
6276
# Build the newly-versioned release distribution
6377
- name: Release | Build the release
78+
# If a new release is not required, we are done.
79+
if: ${{ steps.version_release.outputs.released == 'true' }}
6480
id: build_release
6581
run: |
6682
uv build
@@ -88,8 +104,8 @@ jobs:
88104

89105
test-pypi-publish:
90106
name: Upload release to test.pypi
91-
# if: startsWith(github.ref, 'refs/tags/') # only publish to test.PyPI on tag pushes
92107
needs: release
108+
if: ${{ needs.release.outputs.released == 'true' }}
93109
runs-on: ubuntu-latest
94110
environment:
95111
name: test.pypi

0 commit comments

Comments
 (0)