0.6.1 #51
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !(contains(github.event.head_commit.message, 'chore(release):') || contains(github.event.head_commit.message, 'chore(deps):')) | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
token: ${{ secrets.GH_TOKEN }} | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Upgrade pip | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pip --version | |
- name: Install Poetry | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt poetry | |
poetry --version | |
- name: Install development dependencies | |
run: | | |
poetry install --only dev | |
- name: Check if there is a parent commit | |
id: check-parent-commit | |
run: | | |
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)" | |
- name: Python Semantic Release | |
id: semantic-release | |
if: steps.check-parent-commit.outputs.sha | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
set -o pipefail | |
# Set git details | |
git config --global user.name "Erik Båvenstrand" | |
git config --global user.email "[email protected]" | |
# Run semantic-release | |
poetry run semantic-release publish -v DEBUG -D commit_author="github-actions <[email protected]>" | |
output_value=$(poetry version | awk "{print $2}") | |
echo "::set-output name=version::$output_value" | |
- name: Build package | |
run: | | |
poetry build --ansi | |
- name: Publish package on PyPI | |
if: steps.semantic-release.outputs.version | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |