Skip to content

Deploy to NPM

Deploy to NPM #16

Workflow file for this run

name: Deploy to NPM
on:
push:
# If you add a branch here, you **MUST** create a branch rule in Github settings
branches: ["*.*.x", "*.x", "main", "next", "next-major", "beta", "alpha"]
workflow_dispatch: # trigger manually
inputs:
dry_run:
description: "NPM release dry-run"
required: true
default: "true"
jobs:
# Gihub Actions do not allow regex validation for numbers in *.*.x branch names
validate_branch_name:
runs-on: [self-hosted, ubuntu-22-04, regular]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate branch name
run: |
branch_name=$(echo $GITHUB_REF | cut -d'/' -f3)
if [[ $branch_name =~ ^[0-9]+(\.[0-9]+)?\.x$ ]] || [[ $branch_name == "main" ]] || [[ $branch_name == "next" ]] || [[ $branch_name == "next-major" ]] || [[ $branch_name == "beta" ]] || [[ $branch_name == "alpha" ]]; then
echo "Branch name is valid"
else
echo "Branch name is invalid"
exit 1
fi
unit_tests:
needs: [validate_branch_name]
runs-on: [self-hosted, ubuntu-22-04, regular]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js version 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Set up repo submodules
run: git submodule update --init --recursive
- name: Install dependencies
run: |
npm ci
- name: Unit Tests
run: |
npm run test
npm_release:
needs: [unit_tests]
uses: ./.github/workflows/release.yaml
with:
dry_run: ${{ github.event.inputs.dry_run || 'true' }}
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }}