NPM Release #39
This file contains hidden or 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: NPM Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| packageName: | |
| description: "Package Name (schemas, types, toolkit)" | |
| required: true | |
| version: | |
| description: "Version to publish (e.g., 1.0.0)" | |
| required: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Validate package name | |
| run: | | |
| if [[ ${{ github.event.inputs.packageName }} != "schemas" && ${{ github.event.inputs.packageName }} != "types" && ${{ github.event.inputs.packageName }} != "toolkit" ]]; then | |
| echo "Error: Invalid package name" | |
| exit 1 | |
| fi | |
| - name: Validate version | |
| run: | | |
| if ! [[ ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Error: Invalid version format" | |
| exit 1 | |
| fi | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies and build | |
| run: yarn && yarn build | |
| - name: Configure Yarn for Authentication | |
| run: yarn config set npmAuthToken "${{ secrets.NPM_TOKEN }}" | |
| - name: Build and Publish | |
| run: | | |
| cd packages/${{ github.event.inputs.packageName }} | |
| yarn npm publish --tag ${{ github.event.inputs.version }} --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| token: ${{ secrets.NPM_TOKEN }} |