11name : Publish
2-
32on :
43 release :
5- types : [published, edited]
4+ types : published
5+ permissions :
6+ contents : write
67
78jobs :
89 build :
@@ -11,18 +12,15 @@ jobs:
1112 outputs :
1213 tag : ${{ steps.update-package-version.outputs.version }}
1314 steps :
14- # Configure runner with the right stuff
15- - uses : actions/checkout@v4
16- with :
17- token : ${{ secrets.GITHUB_TOKEN }}
15+ - uses : actions/checkout@v5
1816 - name : Configure git
1917 run : |
2018 git config user.name 'Release Action'
2119 git config user.email '<>'
22- - uses : actions/setup-node@v4
20+ - uses : actions/setup-node@v5
2321 with :
24- node-version : " 20 "
25-
22+ node-version : 20
23+
2624 # Call `npm version`. It increments the version and commits the changes.
2725 # We'll save the output (new version string) for use in the following
2826 # steps
3129 run : |
3230 git tag -d "${{ github.event.release.tag_name }}"
3331 VERSION=$(npm version "${{ github.event.release.tag_name }}" --no-git-tag-version)
34- echo "::set-output name=version::$VERSION"
3532 git add package.json package-lock.json
3633 git commit -m "[skip ci] Bump $VERSION"
3734 git push origin HEAD:main
@@ -47,18 +44,21 @@ jobs:
4744 id : release_info
4845 run : |
4946 # Check for semantic versioning
50- echo "Preparing release for version $longVersion"
5147 longVersion="${{github.event.release.tag_name}}"
48+ echo "Preparing release for version $longVersion"
5249 [[ $longVersion == v[0-9]*.[0-9]*.[0-9]* ]] || (echo "must follow semantic versioning" && exit 1)
5350 majorVersion=$(echo ${longVersion%.*.*})
5451 minorVersion=$(echo ${longVersion%.*})
52+
5553 # Add the built artifacts. Using --force because dist/lib should be in
5654 # .gitignore
5755 git add --force dist lib
56+
5857 # Make the commit
5958 MESSAGE="Build for $(git rev-parse --short HEAD)"
6059 git commit --allow-empty -m "$MESSAGE"
6160 git tag -f -a -m "Release $longVersion" $longVersion
61+
6262 # Get the commit of the tag you just released
6363 commitHash=$(git rev-list -n 1 $longVersion)
6464
0 commit comments