Skip to content

Publish npm packages #7

Publish npm packages

Publish npm packages #7

Workflow file for this run

name: Publish npm packages
on:
workflow_dispatch:
inputs:
release:
description: stable, canary, or release candidate?
required: true
type: choice
options:
- canary
- stable
- release-candidate
type:
description: 'Type of package to publish'
required: true
type: choice
options:
- patch
- minor
- major
jobs:
bump-version:
name: 'Bump Version'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9.4.0
- name: Install Node.js
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org/'
node-version: 20
- name: Run script
run: pnpm run release
id: version-bump
env:
VERSION_TYPE: ${{ github.event.inputs.type }}
RELEASE_TYPE: ${{ github.event.inputs.release }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: pnpm install
- name: Build CLI
run: pnpm run build:scripts
- name: Build Projects
run: pnpm run build
- name: Create Pre-release
if: github.event.inputs.release == 'canary' || github.event.inputs.release == 'release-candidate'
run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes --prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if: github.event.inputs.release == 'stable'
run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish canary
if: github.event.inputs.release == 'canary'
run: npm publish --provenance --access public --workspace vitnode-backend --workspace vitnode-frontend --workspace vitnode-shared --workspace create-vitnode-app --workspace eslint-config-vitnode --tag canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish release candidate
if: github.event.inputs.release == 'release-candidate'
run: npm publish --provenance --access public --workspace vitnode-backend --workspace vitnode-frontend --workspace vitnode-shared --workspace create-vitnode-app --workspace eslint-config-vitnode --tag rc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish stable
if: github.event.inputs.release == 'stable'
run: pnpm publish --provenance --access public --workspace vitnode-backend --workspace vitnode-frontend --workspace vitnode-shared --workspace create-vitnode-app --workspace eslint-config-vitnode
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}