Skip to content

Commit

Permalink
Improve publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Feb 12, 2024
1 parent 576de42 commit ec9bb1d
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -16,26 +19,26 @@ jobs:
- run: npm i
- run: npm run build
- run: |
VERSION=${GITHUB_REF/refs\/tags\//}
TAG='latest'
if [[ $VERSION =~ 'alpha' || $VERSION =~ 'beta' ]]; then
TAG='next'
fi
npm publish --tag $TAG --workspace @studiometa/playground
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- run: |
PRERELEASE=false
# Check release type
if [[ $GITHUB_REF_NAME =~ 'alpha' || $GITHUB_REF_NAME =~ 'beta' || $GITHUB_REF_NAME =~ 'rc' ]]; then
echo "This is a prerelease."
TAG='next'
PRERELEASE=true
fi
echo "is_prerelease=$PRERELEASE" >> $GITHUB_ENV
echo "NPM_TAG=$PRERELEASE" >> $GITHUB_ENV
echo "IS_PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
- uses: JS-DevTools/npm-publish@v3
with:
provenance: true
package: packages/playground/
tag: ${{ env.NPM_TAG }}
token: ${{ secrets.NPM_TOKEN }}
- uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref }}
name: v${{ github.ref_name }}
body: Please refer to [CHANGELOG.md](https://github.com/studiometa/playground/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
draft: false
prerelease: ${{ env.is_prerelease }}
prerelease: ${{ env.IS_PRERELEASE }}

0 comments on commit ec9bb1d

Please sign in to comment.