diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml new file mode 100644 index 0000000..fbdb2a4 --- /dev/null +++ b/.github/workflows/create-release.yaml @@ -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 }}"