v0.0.11 #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to NPM | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish: | |
name: Publish to NPM | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: npm install | |
- name: Bump Version | |
run: | | |
initialTag=${{ github.event.release.tag_name }} | |
tag="${initialTag//[v]/}" | |
TARGET_BRANCH=${{ github.event.release.target_commitish }} | |
./bump-version.sh $tag $TARGET_BRANCH | |
- name: Build library | |
run: npm run build | |
- name: Set release dist-tag | |
run: | | |
releaseTag=${{ github.event.release.tag_name }} | |
if [ "${{ github.event.release.prerelease }}" == "true" ]; then | |
RELEASE_DIST_TAG="experimental" | |
else | |
RELEASE_DIST_TAG="latest" | |
fi | |
dist_tags=("alpha" "beta" "rc") | |
for distTag in "${dist_tags[@]}"; do | |
if [[ $releaseTag == *$distTag* ]]; then | |
RELEASE_DIST_TAG=$distTag | |
break | |
fi | |
done | |
echo "RELEASE_DIST_TAG=$RELEASE_DIST_TAG" >> $GITHUB_ENV | |
echo "Release dist-tag: $RELEASE_DIST_TAG" | |
- name: Publish to NPM | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
RELEASE_DIST_TAG: ${{ env.RELEASE_DIST_TAG }} | |
run: ./publish.sh $RELEASE_DIST_TAG |