refactor: replace Buffer with Uint8Array #8
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: Tag and Publish Package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tag: | |
name: Tag new version | |
runs-on: ubuntu-latest | |
outputs: | |
new_tag: ${{ steps.tag.outputs.new_tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get current version from package.json | |
id: version | |
run: echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT | |
- name: Check if tag already exists | |
id: check | |
run: | | |
if git rev-list -n 1 "v${{ steps.version.outputs.version }}"; then | |
echo "exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Tag new version | |
id: tag | |
if: ${{ steps.check.outputs.exists == 'false' }} | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ steps.version.outputs.version }} | |
build-and-publish: | |
name: Build and publish package | |
runs-on: ubuntu-latest | |
needs: tag | |
if: ${{ needs.tag.outputs.new_tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
registry-url: https://registry.npmjs.org | |
- name: Install dependencies | |
run: npm ci | |
- name: Publish to the npm registry | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |