update deps and bump version #3
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: Create Release | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' # Matches semantic versioning tags like 1.2.3 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Needed for creating releases | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for changelog generation | |
- name: Get tag name | |
id: get_tag | |
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Check version in pyproject.toml | |
id: check_version | |
run: | | |
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
if [ "$VERSION" != "${{ steps.get_tag.outputs.TAG_NAME }}" ]; then | |
echo "Version mismatch: pyproject.toml version is $VERSION, but tag is ${{ steps.get_tag.outputs.TAG_NAME }}" | |
exit 1 | |
fi | |
- name: Generate changelog | |
id: changelog | |
run: | | |
# Get all commits since last tag | |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 ${{ steps.get_tag.outputs.TAG_NAME }}^ 2>/dev/null || echo "") | |
if [ -z "$PREVIOUS_TAG" ]; then | |
# If no previous tag exists, get all commits | |
CHANGELOG=$(git log --pretty=format:"* %s" ${{ steps.get_tag.outputs.TAG_NAME }}) | |
else | |
# Get commits between tags | |
CHANGELOG=$(git log --pretty=format:"* %s" $PREVIOUS_TAG..${{ steps.get_tag.outputs.TAG_NAME }}) | |
fi | |
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT | |
echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.get_tag.outputs.TAG_NAME }} | |
name: Release ${{ steps.get_tag.outputs.TAG_NAME }} | |
body: | | |
## What's Changed | |
${{ steps.changelog.outputs.CHANGELOG }} | |
draft: true | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |