From 039d11c706841ad447453992e26b0bc6927c2208 Mon Sep 17 00:00:00 2001 From: Alexey Taranov Date: Sat, 1 Nov 2025 21:29:12 +0400 Subject: [PATCH 1/2] Draft release github action --- .github/workflows/release.yml | 43 ++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b38468e..b14bf2d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 with: - fetch-depth: 0 # важно, чтобы теги и история были доступны + fetch-depth: 0 # нужно для тегов и истории - name: Install jq run: sudo apt-get install -y jq @@ -45,16 +45,7 @@ jobs: echo "new_version=$new_version" >> $GITHUB_OUTPUT echo "Version bumped to $new_version" - - name: Commit and tag new version - run: | - git config user.name "github-actions[bot]" - git config user.email "actions@github.com" - git add package.json - git commit -m "chore: release v${{ steps.bump_version.outputs.new_version }}" - git tag -a "v${{ steps.bump_version.outputs.new_version }}" -m "Release ${{ steps.bump_version.outputs.new_version }}" - git push origin master --tags - - - name: Generate changelog + - name: Generate changelog text id: changelog run: | last_tag=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") @@ -68,16 +59,42 @@ jobs: echo "$log" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Create GitHub release + - name: Update CHANGELOG.md + run: | + VERSION=${{ steps.bump_version.outputs.new_version }} + DATE=$(date +'%Y-%m-%d') + CHANGELOG="## v$VERSION - $DATE + +${{ steps.changelog.outputs.log }} + +" + # prepend to existing changelog or create new + if [ -f CHANGELOG.md ]; then + echo -e "$CHANGELOG$(cat CHANGELOG.md)" > CHANGELOG.md + else + echo -e "# Changelog\n\n$CHANGELOG" > CHANGELOG.md + fi + + - name: Commit version bump and changelog + run: | + git config user.name "github-actions[bot]" + git config user.email "actions@github.com" + git add package.json CHANGELOG.md + git commit -m "chore: release v${{ steps.bump_version.outputs.new_version }}" + git tag -a "v${{ steps.bump_version.outputs.new_version }}" -m "Release ${{ steps.bump_version.outputs.new_version }}" + git push origin master --tags + + - name: Create draft GitHub release uses: softprops/action-gh-release@v2 with: tag_name: v${{ steps.bump_version.outputs.new_version }} name: Release ${{ steps.bump_version.outputs.new_version }} body: | - Unity package **com.alexeytaranov.serializereferencedropdown** + 🧩 Unity package **com.alexeytaranov.serializereferencedropdown** Version: ${{ steps.bump_version.outputs.new_version }} ### Changelog ${{ steps.changelog.outputs.log }} + draft: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7e1f9c05fb47f7e771905bfd662c1ba604bf2da2 Mon Sep 17 00:00:00 2001 From: Alexey Taranov Date: Sat, 1 Nov 2025 21:30:44 +0400 Subject: [PATCH 2/2] Draft release github action with pull request --- .github/workflows/release.yml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b14bf2d..e5ea25c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,10 @@ on: required: false default: "patch" +permissions: + contents: write + pull-requests: write + jobs: release: runs-on: ubuntu-latest @@ -68,21 +72,28 @@ jobs: ${{ steps.changelog.outputs.log }} " - # prepend to existing changelog or create new if [ -f CHANGELOG.md ]; then echo -e "$CHANGELOG$(cat CHANGELOG.md)" > CHANGELOG.md else echo -e "# Changelog\n\n$CHANGELOG" > CHANGELOG.md fi - - name: Commit version bump and changelog - run: | - git config user.name "github-actions[bot]" - git config user.email "actions@github.com" - git add package.json CHANGELOG.md - git commit -m "chore: release v${{ steps.bump_version.outputs.new_version }}" - git tag -a "v${{ steps.bump_version.outputs.new_version }}" -m "Release ${{ steps.bump_version.outputs.new_version }}" - git push origin master --tags + - name: Create PR with version bump + uses: peter-evans/create-pull-request@v6 + with: + commit-message: "chore: release v${{ steps.bump_version.outputs.new_version }}" + branch: "release/v${{ steps.bump_version.outputs.new_version }}" + title: "Release v${{ steps.bump_version.outputs.new_version }}" + body: | + This PR updates: + - **package.json** + - **CHANGELOG.md** + + After merging, a new draft GitHub release will be created automatically. + labels: release + add-paths: | + package.json + CHANGELOG.md - name: Create draft GitHub release uses: softprops/action-gh-release@v2