Skip to content

Commit 3e4919e

Browse files
feat(ci) CG-10496: semantic release (#328)
# Motivation <!-- Why is this change necessary? --> # Content <!-- Please include a summary of the change --> # Testing <!-- How was the change tested? --> # Please check the following before marking your PR as ready for review - [ ] I have added tests for my changes - [ ] I have updated the documentation or added new documentation as needed
1 parent 967308c commit 3e4919e

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,15 @@ jobs:
7171
path: ./wheelhouse/*.whl
7272

7373
release:
74-
if: startsWith(github.ref, 'refs/tags/')
74+
if: ${{ github.ref == 'refs/heads/develop' }}
7575
needs: build
7676
runs-on: ubuntu-latest
7777
environment: release
7878
permissions:
79-
contents: write # grants permission to create a release on github
79+
contents: write # to be able to publish a GitHub release
80+
issues: write # to be able to comment on released issues
81+
pull-requests: write # to be able to comment on released pull requests
82+
id-token: write # to enable use of OIDC for npm provenance
8083
steps:
8184
- uses: actions/checkout@v4
8285

@@ -90,22 +93,21 @@ jobs:
9093
merge-multiple: true
9194
pattern: wheels-*
9295

93-
- name: Release PyPI
96+
- name: Github release
97+
uses: codfish/semantic-release-action@v3
98+
id: semantic
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
102+
- name: PyPI release
103+
if: steps.semantic.outputs.new-release-published == 'true'
94104
run: |
95105
export UV_PUBLISH_PASSWORD="${{ secrets.PYPI_TOKEN }}"
96106
export UV_PUBLISH_USERNAME="__token__"
97107
uv publish --publish-url https://upload.pypi.org/legacy/
98108
99-
- name: Make github release
100-
id: github-release
101-
uses: softprops/action-gh-release@v2
102-
with:
103-
files: dist/*
104-
fail_on_unmatched_files: true
105-
generate_release_notes: true
106-
107109
- uses: slackapi/[email protected]
108-
if: always()
110+
if: always() && steps.semantic.outputs.new-release-published == 'true'
109111
with:
110112
method: chat.postMessage
111113
token: ${{ secrets.SLACK_BOT_TOKEN }}

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"private": true,
3+
"release": {
4+
"branches": ["develop"],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
[
9+
"@semantic-release/github",
10+
{
11+
"assets": ["dist/**"]
12+
}
13+
]
14+
]
15+
}
16+
}

0 commit comments

Comments
 (0)