Create Release #2
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: Create Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
description: Version number of new release in form '0.2.0' | |
required: true | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
environment: main | |
steps: | |
- name: Validate version input | |
run: | | |
echo "${{ inputs.version }}" | grep -qEo '[0-9]+\.[0-9]+\.[0-9]+' | |
if [ $? -ne 0 ]; then | |
echo "Invalid version number. Please use the format '0.2.0'" | |
exit 1 | |
fi | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT }} | |
- name: Install `uv` | |
run: | | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Bump package version | |
run: | | |
sed -i 's/^\(version = \).*$/\1'\"${{ inputs.version }}\"'/' pyproject.toml | |
uv sync | |
- name: Commit, tag and push | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add -A . | |
git commit -m "chore: bump version to ${{ inputs.version }}" | |
git tag -a "${{ inputs.version }}" -m "${{ inputs.version }}" | |
git push origin main "${{ inputs.version }}" |