-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add create release action to ease releasing
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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 }}" |