-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.79 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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 }}