Skip to content

Commit

Permalink
ci: test npm deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ron de las Alas committed Oct 25, 2023
1 parent 5ac7b3c commit 257a376
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,23 @@ jobs:
publish_dir: ./gh-pages
full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
enable_jekyll: true
- name: Deploy to npm
run: |
export RELEASE_VERSION="0.2.0-prerelease.$(date +'%Y%m%d%H%M%S')"
if [[ "${{contains(github.ref, 'hotfix')}} ]]; then
export NPM_TAG=hotfix
elif [[ "${{contains(github.ref, 'beta')}} ]]; then
export NPM_TAG=beta
else
export NPM_TAG=latest
fi
echo "Deploying version $RELEASE_VERSION to $NPM_TAG"
npm --no-git-tag-version version $RELEASE_VERSION
npm set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}
npm publish --tag $NPM_TAG
if npm info | grep -q $RELEASE_VERSION; then
git tag $RELEASE_VERSION
git push \
https://${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository_owner}}/${{github.repository}}.git \
$RELEASE_VERSION
fi

0 comments on commit 257a376

Please sign in to comment.