Skip to content

Upgrade click

Upgrade click #50

Workflow file for this run

name: Release
on:
push:
branches:
- main
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v5
- 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: Detect and tag new version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/action-detect-and-tag-new-version@v2.0.1
with:
version-command: |
bash -o pipefail -c "grep '^version =' pyproject.toml | awk -F '\"' '{ print \$2 }'"
- name: Bump version for developmental release
if: "! steps.check-version.outputs.tag"
run: |
current_version=$(grep '^version =' pyproject.toml | awk -F '"' '{ print $2 }')
IFS='.' read -r major minor patch <<< "$current_version"
new_patch=$((patch + 1))
dev_version="${major}.${minor}.${new_patch}.dev$(date +%s)"
sed -i "s/^version = .*/version = \"$dev_version\"/" pyproject.toml
echo "Bumped version from $current_version to $dev_version"
- name: Build package
run: |
uv build
- name: Publish package on PyPI
if: steps.check-version.outputs.tag
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
- name: Publish the release notes
uses: release-drafter/release-drafter@v5.18.1
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}