diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5b3581..8919b8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,6 +124,7 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 with: + token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml fail_ci_if_error: false verbose: true diff --git a/.github/workflows/cut-release.yml b/.github/workflows/cut-release.yml new file mode 100644 index 0000000..15b18f1 --- /dev/null +++ b/.github/workflows/cut-release.yml @@ -0,0 +1,71 @@ +name: Cut Release + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to release (e.g., v0.2.0 or v0.2.0-beta1)' + required: true + type: string + +permissions: + contents: write + +jobs: + cut-release: + name: Cut Release + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate version format + run: | + VERSION="${{ github.event.inputs.version }}" + if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then + echo "Error: Version must be in format v0.0.0 or v0.0.0-suffix" + echo "Got: $VERSION" + exit 1 + fi + echo "VERSION=$VERSION" >> $GITHUB_ENV + # Strip the 'v' prefix for pyproject.toml + echo "VERSION_NUM=${VERSION#v}" >> $GITHUB_ENV + + - name: Check if tag already exists + run: | + if git rev-parse "$VERSION" >/dev/null 2>&1; then + echo "Error: Tag $VERSION already exists" + exit 1 + fi + + - name: Update version in pyproject.toml + run: | + sed -i "s/^version = \".*\"/version = \"$VERSION_NUM\"/" pyproject.toml + echo "Updated pyproject.toml to version $VERSION_NUM" + grep "^version" pyproject.toml + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Commit version bump + run: | + git add pyproject.toml + git commit -m "Bump version to $VERSION" + + - name: Create and push tag + run: | + git tag -a "$VERSION" -m "Release $VERSION" + git push origin HEAD:${{ github.ref_name }} + git push origin "$VERSION" + + - name: Summary + run: | + echo "## Release $VERSION created!" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "The tag \`$VERSION\` has been pushed and will trigger the release workflow." >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "Check the [Release workflow](/${{ github.repository }}/actions/workflows/release.yml) for progress." >> $GITHUB_STEP_SUMMARY