1- # .github/workflows/release.yml
21name : Release
32
43on :
1716jobs :
1817 release-please :
1918 runs-on : ubuntu-latest
20- # Only run on merged PRs or manual dispatch
2119 if : github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true)
2220 outputs :
2321 releases_created : ${{ steps.manual_release.outputs.releases_created }}
@@ -38,58 +36,65 @@ jobs:
3836 run : |
3937 npm install -g release-please
4038 npm install semver
41-
42- # Configure git
39+
4340 git config --global user.name "github-actions[bot]"
4441 git config --global user.email "github-actions[bot]@users.noreply.github.com"
45-
46- # Get current version from manifest
42+
4743 CURRENT_VERSION=$(cat .release-please-manifest.json | jq -r '.Website')
4844 echo "Current version: $CURRENT_VERSION"
49-
50- # Calculate next version based on release type using Node.js
45+
5146 NEXT_VERSION=$(node -e "
5247 const semver = require('semver');
5348 const current = '$CURRENT_VERSION';
5449 const type = '${{ github.event.inputs.release_type }}';
5550 console.log(semver.inc(current, type));
5651 ")
57-
52+
5853 echo "Next version will be: $NEXT_VERSION"
59-
60- # Update version in package.json
54+
6155 cd Website
6256 npm version $NEXT_VERSION --no-git-tag-version
6357 cd ..
64-
65- # Update manifest file
58+
6659 jq --arg version "$NEXT_VERSION" '.Website = $version' .release-please-manifest.json > temp.json && mv temp.json .release-please-manifest.json
67-
68- # Generate changelog entry
60+
6961 echo "## [$NEXT_VERSION] - $(date +'%Y-%m-%d')" > temp_changelog.md
7062 echo "" >> temp_changelog.md
7163 echo "### Changed" >> temp_changelog.md
72- echo "- Manual ${{ github.event.inputs.release_type }} release" >> temp_changelog.md
64+
65+ LAST_TAG="website-v$CURRENT_VERSION"
66+ git fetch --tags
67+ if git rev-parse "$LAST_TAG" >/dev/null 2>&1; then
68+ echo "- Changes since $CURRENT_VERSION:" >> temp_changelog.md
69+ COMMITS=$(git log "$LAST_TAG"..HEAD --pretty=format:"- %s")
70+ if [ -n "$COMMITS" ]; then
71+ echo "$COMMITS" >> temp_changelog.md
72+ else
73+ echo "- No new commits since last version" >> temp_changelog.md
74+ fi
75+ else
76+ echo "- Manual ${{ github.event.inputs.release_type }} release" >> temp_changelog.md
77+ echo "- (No previous tag $LAST_TAG found to compare commits)" >> temp_changelog.md
78+ fi
7379 echo "" >> temp_changelog.md
74-
75- # Prepend to existing changelog if it exists
80+
7681 if [ -f "Website/CHANGELOG.md" ]; then
7782 cat temp_changelog.md Website/CHANGELOG.md > temp_full_changelog.md
7883 mv temp_full_changelog.md Website/CHANGELOG.md
7984 else
8085 mv temp_changelog.md Website/CHANGELOG.md
8186 fi
82-
83- # Commit and push changes
87+
8488 git add .
8589 git commit -m "chore(release): release $NEXT_VERSION
8690
8791 Release type: ${{ github.event.inputs.release_type }}
8892 Previous version: $CURRENT_VERSION
8993 New version: $NEXT_VERSION"
90-
91- git push origin HEAD
92-
94+
95+ git tag -a "website-v$NEXT_VERSION" -m "Release $NEXT_VERSION"
96+ git push origin HEAD --tags
97+
9398 echo "releases_created=true" >> $GITHUB_OUTPUT
9499 echo "version=$NEXT_VERSION" >> $GITHUB_OUTPUT
95100
0 commit comments