🔖 Release v0.2.0 #9
Workflow file for this run
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: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version to release (e.g., v1.0.0)" | |
required: true | |
default: "" | |
push: | |
tags: | |
- v* | |
jobs: | |
pypi-publish: | |
name: Upload release to PyPI | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup PDM | |
uses: pdm-project/[email protected] | |
with: | |
python-version: 3.9 | |
- name: Prepare pdm environment | |
run: pdm show --version | |
- name: Get Version | |
id: version | |
run: | | |
INPUT_VERSION="${{ github.event.inputs.version }}" | |
TAG_VERSION=${{ github.ref_name || '' }} | |
VERSION=$(pdm show --version) | |
echo "Debug - Parsed VERSION: $VERSION" | |
echo "Debug - INPUT_VERSION: $INPUT_VERSION" | |
echo "Debug - TAG_VERSION: $TAG_VERSION" | |
if [ -n "$INPUT_VERSION" ]; then | |
echo "VERSION=$INPUT_VERSION" >> $GITHUB_OUTPUT | |
echo "TAG_VERSION=${INPUT_VERSION#v}" >> $GITHUB_OUTPUT | |
else | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
echo "TAG_VERSION=${TAG_VERSION#v}" >> $GITHUB_OUTPUT | |
fi | |
- name: Check Version | |
if: ${{ steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION }} | |
run: exit 1 | |
- name: Build distribution files | |
run: pdm build | |
- name: Publish package distributions to PyPI | |
run: pdm publish | |
- name: Publish package to GitHub | |
run: | | |
gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |