Skip to content

Commit a0cf114

Browse files
committed
Update publish CI
1 parent b2d953f commit a0cf114

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

.github/workflows/npm-publish.yml

+19-28
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,28 @@ jobs:
1717
registry-url: https://registry.npmjs.org/
1818

1919
- run: |
20-
VERSION=${GITHUB_REF/refs\/tags\//}
21-
TAG='latest'
22-
if [[ $VERSION =~ 'alpha' || $VERSION =~ 'beta' || $VERSION =~ 'rc' ]]; then
23-
TAG='next'
24-
fi
25-
npm publish --tag $TAG
26-
env:
27-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
20+
NPM_TAG='latest'
21+
IS_PRERELEASE=false
2822
29-
# @see https://github.com/actions/create-release/issues/38#issuecomment-715327220
30-
# @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files
31-
- name: Prepare the changelog from the tag message
32-
id: prepare_changelog
33-
run: |
34-
PRERELEASE=false
35-
# Check release type
3623
if [[ $GITHUB_REF_NAME =~ 'alpha' || $GITHUB_REF_NAME =~ 'beta' || $GITHUB_REF_NAME =~ 'rc' ]]; then
37-
echo "This is a prerelease."
38-
PRERELEASE=true
24+
NPM_TAG='next'
25+
IS_PRERELEASE=true
3926
fi
40-
echo "is_prerelease=$PRERELEASE" >> $GITHUB_ENV
4127
42-
# @see https://github.com/actions/create-release
43-
- name: Create Release
44-
id: create_release
45-
uses: actions/create-release@v1
46-
env:
47-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
echo "NPM_TAG=$NPM_TAG" >> $GITHUB_ENV
29+
echo "IS_PRERELEASE=$IS_PRERELEASE" >> $GITHUB_ENV
30+
31+
- uses: JS-DevTools/npm-publish@v3
32+
with:
33+
provenance: true
34+
package: .
35+
tag: ${{ env.NPM_TAG }}
36+
token: ${{ secrets.NPM_TOKEN }}
37+
38+
- uses: ncipollo/release-action@v1
4839
with:
49-
tag_name: ${{ github.ref }}
50-
release_name: v${{ github.ref_name }}
51-
body: Please refer to [CHANGELOG.md](https://github.com/studiometa/prettier-formatter-gitlab/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
40+
tag: ${{ github.ref }}
41+
name: v${{ github.ref_name }}
42+
body: Please refer to [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
5243
draft: false
53-
prerelease: ${{ env.is_prerelease }}
44+
prerelease: ${{ env.IS_PRERELEASE }}

0 commit comments

Comments
 (0)