Merge pull request #4 from tsxper/detach-nodejs #4
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 Package to npmjs | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'package.json' | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
env: | |
CI_COMMIT_EMAIL: username@users.noreply.github.com | |
CI_COMMIT_AUTHOR: CI Bot | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get tag | |
id: get_tag | |
run: | | |
echo "version=v$(npm pkg get version | tr -d '\"')" >> $GITHUB_OUTPUT | |
- name: Tag the commit | |
run: | | |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" | |
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" | |
next_version=${{ steps.get_tag.outputs.version }} | |
git tag -a "$next_version" -m "Version $next_version" | |
git push origin "$next_version" | |
publish: | |
runs-on: ubuntu-latest | |
needs: tag | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Install dependencies | |
run: yarn install | |
- run: yarn lint | |
- run: yarn build | |
- run: yarn test:ci | |
- run: yarn pub | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |