7575 commit_message : update changelog
7676 branch : main
7777
78+ delete-create-new-tag :
79+ # For a full release, we delete and create a new tag to reflect the latest changes in the CHANGELOG.rst.
80+ # Recall that during the full release, the `main` branch's CHANGELOG.rst has been updated, and we want the
81+ # tag to reflect the latest changes in the CHANGELOG.rst done by the update-changelog above.
82+ # For more discussions, please read https://github.com/Billingegroup/release-scripts/pull/120
83+ needs : [update-changelog]
84+ # Always run this job for a full release but fail if the update-changelog job previously failed.
85+ if : " always() && !contains(github.ref, 'rc')"
86+ runs-on : ubuntu-latest
87+ steps :
88+ - name : Fail delete-create-new-tag job if CHANGELOG update failed
89+ run : |
90+ if [ "${{ needs.update-changelog.result }}" == 'success' ]; then
91+ echo "Ready to delete and create new tag containing the latest CHANGELOG.rst update in the main branch..."
92+ else
93+ echo "Previous update-changelog job failed; exiting..."
94+ exit 1
95+ fi
96+ - name : Checkout the repository
97+ uses : actions/checkout@v4
98+ with :
99+ ref : main
100+ - name : Delete the tag
101+ run : |
102+ git fetch --tags
103+ git tag -d "${{ github.ref_name }}"
104+ git push origin ":${{ github.ref_name }}"
105+ - name : Create a new tag (Expect commit SHA to match with that of main branch)
106+ run : |
107+ git tag "${{ github.ref_name }}"
108+ git push origin "${{ github.ref_name }}"
109+
78110 github-pre-release :
79111 needs : [build-pure-python-package, build-non-pure-python-package]
80112 if : " always() && contains(github.ref, 'rc')"
@@ -97,13 +129,13 @@ jobs:
97129 token : ${{ secrets.GITHUB_TOKEN }}
98130
99131 github-release :
100- needs : [update-changelog ]
132+ needs : [delete-create-new-tag ]
101133 if : " always() && !contains(github.ref, 'rc')"
102134 runs-on : ubuntu-latest
103135 steps :
104136 - name : Fail github-release job if CHANGELOG update failed
105137 run : |
106- if [ "${{ needs.update-changelog .result }}" == 'success' ]; then
138+ if [ "${{ needs.delete-create-new-tag .result }}" == 'success' ]; then
107139 echo "Ready to release on GitHub..."
108140 else
109141 echo "Previous update-changelog job failed; exiting..."
@@ -159,3 +191,11 @@ jobs:
159191 TWINE_PASSWORD : ${{ secrets.PYPI_TOKEN }}
160192 run : |
161193 twine upload dist/* --verbose
194+
195+ docs :
196+ needs : [github-pre-release, github-release]
197+ if : always()
198+ uses : ./.github/workflows/_publish-docs-on-release.yml
199+ with :
200+ project : ${{ inputs.project }}
201+ c_extension : ${{ inputs.c_extension }}
0 commit comments