publish package npm #26
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 package npm | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
# https://semver.org/ proper release tags, more or less | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
# prerelease tags, more or less | |
- "v[0-9]+.[0-9]+.[0-9]+-*" | |
env: | |
NODE_VERSION: 18.20.4 | |
LANG: en_US.UTF-8 | |
LC_ALL: en_US.UTF-8 | |
TASK_X_REMOTE_TASKFILES: 1 | |
jobs: | |
publish: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Check out a copy of the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- id: get_version | |
uses: battila7/get-version-action@v2 | |
- name: show tag | |
id: tag | |
run: | | |
echo ::set-output name=TAG::${{ steps.get_version.outputs.version-without-v }} | |
- name: publish package npm | |
id: publish | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
tag: latest | |
- if: steps.publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" |