feat: MakeDiffParser.parse
async to offload it from MainActor
#8
Workflow file for this run
This file contains hidden or 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: | |
pull_request: | |
types: [closed] | |
branches: [ "main" ] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
# Only run when PR is merged (not just closed) and has 'release' label | |
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get latest tag | |
id: get_tag | |
run: | | |
# Get the latest tag, or set to 0.0.0 if no tags exist | |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") | |
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT | |
echo "Latest tag: $LATEST_TAG" | |
- name: Calculate next version | |
id: next_version | |
run: | | |
LATEST_TAG="${{ steps.get_tag.outputs.latest_tag }}" | |
# Remove 'v' prefix if present | |
VERSION=${LATEST_TAG#v} | |
# Split version into components | |
IFS='.' read -ra VERSION_PARTS <<< "$VERSION" | |
MAJOR=${VERSION_PARTS[0]:-0} | |
MINOR=${VERSION_PARTS[1]:-0} | |
PATCH=${VERSION_PARTS[2]:-0} | |
# Check PR labels for version bump type | |
if ${{ contains(github.event.pull_request.labels.*.name, 'major') }}; then | |
MAJOR=$((MAJOR + 1)) | |
MINOR=0 | |
PATCH=0 | |
echo "Major version bump" | |
elif ${{ contains(github.event.pull_request.labels.*.name, 'minor') }}; then | |
MINOR=$((MINOR + 1)) | |
PATCH=0 | |
echo "Minor version bump" | |
else | |
# Default to patch bump | |
PATCH=$((PATCH + 1)) | |
echo "Patch version bump" | |
fi | |
# Create new version | |
NEW_VERSION="$MAJOR.$MINOR.$PATCH" | |
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
echo "New version: $NEW_VERSION" | |
- name: Create tag | |
run: | | |
NEW_VERSION="${{ steps.next_version.outputs.new_version }}" | |
git config user.name github-actions | |
git config user.email [email protected] | |
git tag -a "$NEW_VERSION" -m "Release version $NEW_VERSION" | |
git push origin "$NEW_VERSION" | |
- name: Generate release notes | |
id: release_notes | |
run: | | |
# Extract PR body for release notes | |
PR_BODY=$(cat << 'EOF' | |
${{ github.event.pull_request.body }} | |
EOF | |
) | |
# Create release notes | |
cat << EOF > release_notes.md | |
## Release ${{ steps.next_version.outputs.new_version }} | |
### Pull Request | |
#${{ github.event.pull_request.number }} - ${{ github.event.pull_request.title }} | |
### Description | |
${PR_BODY} | |
### Changes | |
See the [full changelog](https://github.com/${{ github.repository }}/compare/${{ steps.get_tag.outputs.latest_tag }}...${{ steps.next_version.outputs.new_version }}) | |
### Contributors | |
- @${{ github.event.pull_request.user.login }} | |
EOF | |
# Output the release notes | |
echo "release_notes<<EOF" >> $GITHUB_OUTPUT | |
cat release_notes.md >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.next_version.outputs.new_version }} | |
release_name: Release ${{ steps.next_version.outputs.new_version }} | |
body: ${{ steps.release_notes.outputs.release_notes }} | |
draft: false | |
prerelease: false |