| 1 |
# This workflow publishes a package to NPM under the `next` tag |
| 2 |
|
| 3 |
name: Prerelease package on npm |
| 4 |
|
| 5 |
on: |
| 6 |
push: |
| 7 |
branches: |
| 8 |
- prerelease |
| 9 |
|
| 10 |
jobs: |
| 11 |
prerelease: |
| 12 |
runs-on: ubuntu-latest |
| 13 |
steps: |
| 14 |
- name: Checkout repository |
| 15 |
uses: actions/checkout@v5 |
| 16 |
|
| 17 |
- name: Set up node |
| 18 |
uses: actions/setup-node@v5 |
| 19 |
with: |
| 20 |
node-version: 20 |
| 21 |
cache: 'npm' |
| 22 |
|
| 23 |
- name: Install dependencies |
| 24 |
run: npm ci |
| 25 |
|
| 26 |
- name: Get package version |
| 27 |
uses: martinbeentjes/[email protected] |
| 28 |
id: version |
| 29 |
|
| 30 |
- name: Publish if prerelease |
| 31 |
run: | |
| 32 |
if [[ "${{ steps.version.outputs.current-version}}" =~ ^(.*-(alpha|beta|next|rc)(\..+)?)$ ]]; then |
| 33 |
npm publish --access public --tag next |
| 34 |
else |
| 35 |
echo "Skipping publish since version is not a prerelease." |
| 36 |
fi |
| 37 |
env: |
| 38 |
NODE_AUTH_TOKEN: ${{secrets.npm_token}} |