11name : Build & Release
22
33on :
4+ workflow_call :
5+ inputs :
6+ tag :
7+ required : true
8+ type : string
9+ description : Tag to release
10+ # TODO(CG-10758): create if it does not exist
11+ # workflow_dispatch:
12+ # inputs:
13+ # tag:
14+ # required: true
15+ # type: string
16+ # description: Tag to release # TODO: create if it does not exist
417 push :
518 tags :
619 - v*
7- branches :
8- - develop
920 pull_request :
1021 branches :
1122 - develop
12- workflow_dispatch :
1323
1424permissions :
1525 contents : read
4151 - uses : actions/checkout@v4
4252 with :
4353 fetch-depth : 0
44- ref : ${{ github.event.pull_request.head.ref || github.ref }}
54+ ref : ${{ inputs.tag || github.event.pull_request.head.ref || github.ref }}
4555
4656 - name : Install UV
4757 uses : astral-sh/setup-uv@v5.2
@@ -69,71 +79,17 @@ jobs:
6979 name : wheels-${{ matrix.os }}-3.${{ matrix.python }}
7080 path : ./wheelhouse/*.whl
7181
72- auto-release :
73- if : github.ref_name == 'develop'
74- environment : release
82+ release :
83+ if : ${{ inputs.tag || startsWith(github.ref, 'refs/tags/') }}
7584 needs : build
7685 runs-on : ubuntu-latest
77- permissions :
78- checks : read # to wait for required checks
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- steps :
83- - uses : actions/checkout@v4
84- with :
85- fetch-depth : 0
86-
87- # TODO(CG-10743): clean-up once we remove LFS
88- - name : Remove pre-push hook
89- run : rm -f .git/hooks/pre-push
90-
91- - name : Setup environment
92- uses : ./.github/actions/setup-environment
93-
94- - name : Wait for required checks
95- uses : poseidon/wait-for-status-checks@v0.6.0
96- with :
97- token : ${{ secrets.GITHUB_TOKEN }}
98- match_pattern : " (unit-tests|integration-tests)"
99-
100- - name : Download All Artifacts
101- uses : actions/download-artifact@v4
102- with :
103- path : dist
104- merge-multiple : true
105- pattern : wheels-*
106-
107- - name : Github semantic release
108- uses : codfish/semantic-release-action@v3
109- id : semantic
110- env :
111- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
112-
113- - name : Release PyPI
114- if : ${{ steps.semantic.outputs.new-release-published == 'true' }}
115- uses : ./.github/actions/release-pypi
116- with :
117- pypi-token : ${{ secrets.PYPI_TOKEN }}
118-
119- - name : Slack notification
120- if : ${{ steps.semantic.outputs.new-release-published == 'true' }}
121- uses : ./.github/actions/release-slack-bot
122- with :
123- release-tag : ${{ steps.semantic.outputs.release-version }}
124- slack-token : ${{ secrets.SLACK_BOT_TOKEN }}
125-
126- manual-release :
127- if : startsWith(github.ref, 'refs/tags/')
12886 environment : release
129- needs : build
130- runs-on : ubuntu-latest
13187 permissions :
13288 contents : write # grants permission to create a release on github
13389 steps :
13490 - uses : actions/checkout@v4
13591
136- - name : Setup environment
92+ - name : Setup backend
13793 uses : ./.github/actions/setup-environment
13894
13995 - name : Download All Artifacts
@@ -152,9 +108,10 @@ jobs:
152108 id : github-release
153109 uses : softprops/action-gh-release@v2
154110 with :
111+ tag_name : ${{ inputs.tag || github.ref_name }}
155112 files : dist/*
156113 fail_on_unmatched_files : true
157- generate_release_notes : true
114+ generate_release_notes : ${{ startsWith(github.ref, 'refs/tags/') }}
158115
159116 - name : Slack notification
160117 if : always()
0 commit comments