Release library on GitHub #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Release library on GitHub" | |
on: | |
workflow_run: | |
workflows: ["Setup, Build, and Test"] | |
types: | |
- completed | |
branches: | |
- main | |
jobs: | |
release: | |
name: Release library | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
strategy: | |
matrix: | |
python-version: ["3.11"] # Config the virtual env - Python version 3.11 will be used only. | |
permissions: | |
contents: write # IMPORTANT: mandatory for making GitHub Releases | |
actions: read # IMPORTANT: mandatory for downloading artifacts | |
steps: | |
# Checkout GitHub branch's config | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Download binary package | |
- name: Download built package | |
uses: actions/download-artifact@v4 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
run-id: ${{ github.event.workflow_run.id }} | |
name: built-package | |
path: dist/ | |
# Generate checksums | |
- name: Generate SHA256 files for each wheel | |
run: | | |
sha256sum dist/*.whl > checksums.txt | |
cat checksums.txt | |
# Tag changes pushed to the main branch | |
- name: Bump version and tag | |
id: tag_version | |
uses: anothrNick/github-tag-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELEASE_BRANCHES: main | |
WITH_V: true | |
# Create release on GitHub | |
- name: Create release with SHA256 and Artifacts | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ steps.tag_version.outputs.new_tag }} | |
files: | | |
dist/*.whl | |
checksums.txt |