[v1.0.2] Release #8
Workflow file for this run
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
# This workflow automatically creates a GitHub release for the project on successful version update | |
name: Create a GitHub release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
name: Build Binaries for ${{ matrix.os }}-${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
python-version: [ | |
'3.10', | |
'pypy-3.8', | |
] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: Gr1N/setup-poetry@v9 | |
- name: Install library and dependencies | |
run: | | |
poetry run pip install --upgrade pip setuptools | |
poetry install | |
- name: Build releases | |
run: | | |
poetry build | |
- name: Upload builds | |
uses: actions/upload-artifact@v4 | |
with: | |
name: built-binary | |
path: | | |
dist/*.whl | |
dist/*.tar.gz | |
release: | |
name: Create Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-binary | |
- name: Check Version | |
uses: nowsprinting/check-version-format-action@v4 | |
id: version | |
with: | |
prefix: 'v' | |
- name: Check for Pre-release | |
uses: haya14busa/action-cond@v1 | |
id: is_prerelease | |
with: | |
cond: ${{ steps.version.outputs.prerelease != '' }} | |
if_true: true | |
if_false: false | |
- name: Get Newest Changelog | |
run: | | |
python -c "import re; from pathlib import Path; text=re.sub('<!--(.*?)-->', '', (Path.cwd() / 'CHANGELOG.md').read_text(), flags=re.DOTALL); start=text.find('_' * 79); (Path.cwd() / 'TEMP_CHANGELOG.md').write_text(text[start:text.find('_' * 79, start+1)])" | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: ${{ steps.is_prerelease.outputs.value }} | |
body_path: ./TEMP_CHANGELOG.md | |
files: | | |
*.whl | |
*.tar.gz |