Skip to content

Merge pull request #19 from NxtLvLSoftware/dev-to-dist #20

Merge pull request #19 from NxtLvLSoftware/dev-to-dist

Merge pull request #19 from NxtLvLSoftware/dev-to-dist #20

name: Publish Package
on:
push:
branches: [dist]
tags:
- '*'
permissions:
contents: read
jobs:
publish:
name: Publish to npm registry
runs-on: ubuntu-latest
timeout-minutes: 5
env:
NODE_VERSION: 18
steps:
- name: Wait for CI success
if: github.event_name == 'push'
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: Run tests (${{ env.NODE_VERSION }})
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Wait for example package CI success
if: github.event_name == 'push'
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: Run example package tests (${{ env.NODE_VERSION }})
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Wait for example project CI success
if: github.event_name == 'push'
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: Run example project tests (${{ env.NODE_VERSION }})
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
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 == 'tag'
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 }}