@@ -12,21 +12,20 @@ jobs:
1212 contents : write
1313
1414 # Only run if this is a merge commit (PR merge) and contains version bump
15- if : " contains(github.event.head_commit.message, 'release: bump version to v')"
15+ if : |
16+ contains(github.event.head_commit.message, 'Merge pull request #') &&
17+ contains(github.event.head_commit.message, 'from dandehoon/release/v')
1618
1719 steps :
1820 - name : Checkout code
1921 uses : actions/checkout@v4
2022 with :
2123 fetch-depth : 0
2224
23- - name : Extract version from commit message
25+ - name : Extract version from package.json
2426 id : extract-version
25- uses : actions-ecosystem/action-regex-match@v2
26- with :
27- text : ${{ github.event.head_commit.message }}
28- regex : ' release: bump version to v([\d.]+)'
29- flags : gm
27+ run : |
28+ echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
3029
3130 - name : Setup Node.js
3231 uses : actions/setup-node@v4
@@ -63,27 +62,27 @@ jobs:
6362 - name : Generate changelog
6463 id : changelog
6564 run : |
66- PREV_TAG=$(git describe --tags --abbrev=0 HEAD^)
67- echo "Previous tag: $PREV_TAG"
68- echo 'changelog<<EOF' >> $GITHUB_OUTPUT
69- git log --pretty=format:'- %s (%an)' $PREV_TAG..HEAD >> $GITHUB_OUTPUT
70- echo 'EOF' >> $GITHUB_OUTPUT
71-
72- - name : Create Tag
73- uses : mathieudutour/github-tag-action@v6.1
74- with :
75- custom_tag : v${{ steps.extract-version.outputs.group1 }}
76- github_token : ${{ secrets.GITHUB_TOKEN }}
77- tag_prefix : ' '
78- tag_message : ' Release v${{ steps.extract-version.outputs.group1 }}'
65+ DELIM=__CHANGELOG_EOF_$(uuidgen)__
66+ {
67+ echo "changelog<<$DELIM"
68+ if git tag | grep -q .; then
69+ PREV_TAG=$(git describe --tags --abbrev=0 HEAD^)
70+ git log --pretty=format:'- %s (%an)' $PREV_TAG..HEAD || echo "- Initial release"
71+ else
72+ git log --pretty=format:'- %s (%an)' || echo "- Initial release"
73+ fi
74+ printf '\n%s\n' "$DELIM"
75+ } >> "$GITHUB_OUTPUT"
7976
8077 - name : Create GitHub Release
8178 uses : softprops/action-gh-release@v2
8279 with :
83- tag_name : v${{ steps.extract-version.outputs.group1 }}
84- name : Release v${{ steps.extract-version.outputs.group1 }}
80+ token : ${{ secrets.GITHUB_TOKEN }}
81+ tag_name : v${{ steps.extract-version.outputs.version }}
82+ target_commitish : ${{ github.sha }}
83+ name : Release v${{ steps.extract-version.outputs.version }}
8584 body : |
86- ## Release v${{ steps.extract-version.outputs.group1 }}
85+ ## Release v${{ steps.extract-version.outputs.version }}
8786
8887 Automated release created from version bump commit.
8988
9291
9392 **Installation:**
9493 - Download the `.vsix` file from the assets below
95- - Install via VS Code: `code --install-extension vscode-generic-expand-selection-${{ steps.extract-version.outputs.group1 }}.vsix`
94+ - Install via VS Code: `code --install-extension vscode-generic-expand-selection-${{ steps.extract-version.outputs.version }}.vsix`
9695 - Or install from VS Code Extensions marketplace
9796 files : |
9897 out.vsix
0 commit comments