Merge pull request #38 from NxtLvLSoftware/dev-to-dist #38
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 | |
on: | |
push: | |
branches: [dist] | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GITHUB_ACTIONS: true | |
NODE_VERSION: 22 | |
PNPM_VERSION: 9 | |
jobs: | |
publish: | |
name: Publish to npm registry | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: 'https://registry.npmjs.org' | |
- name: Export tag env var | |
run: | | |
SHORT_SHA=${GITHUB_SHA::7} | |
echo "NPM_TAG=`echo '0.0.0-dist.'$SHORT_SHA`" >> $GITHUB_ENV | |
- name: Publish ${NPM_TAG} to npm registry | |
if: github.event_name == 'push' | |
run: | | |
npm config set git-tag-version false | |
npm version ${NPM_TAG} | |
npm publish --access public --tag rc | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Publish ${{ github.ref_name }} to npm registry | |
if: github.event_name == 'release' | |
run: | | |
npm config set allow-same-version true | |
npm config set git-tag-version false | |
npm version ${{ github.ref_name }} | |
npm publish --access public --tag latest | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |