-
Notifications
You must be signed in to change notification settings - Fork 9
64 lines (56 loc) · 1.89 KB
/
build.yml
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
64
on:
pull_request:
push:
branches:
- '**'
env:
GITHUB_SERVICE_USER: "rajsite"
GITHUB_SERVICE_EMAIL: "[email protected]"
HAS_GITHUBPAGESDEPLOYTOKEN: ${{secrets.GITHUBPAGESDEPLOYTOKEN != ''}}
HAS_NPM_TOKEN: ${{secrets.NPM_TOKEN != ''}}
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
if: env.HAS_GITHUBPAGESDEPLOYTOKEN == 'true'
with:
# Must checkout with a token that can push to protected branches for beachball
# Cannot rely on GITHUB_TOKEN with workflow contents permission
# See: https://github.com/orgs/community/discussions/40971
token: ${{ secrets.GITHUBPAGESDEPLOYTOKEN }}
- uses: actions/checkout@v4
if: env.HAS_GITHUBPAGESDEPLOYTOKEN == 'false'
# Install dependencies
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- run: npm ci
# Build
- run: npm run pack
- uses: actions/upload-artifact@v4
with:
name: packages
path: packages/**/*.tgz
if-no-files-found: error
# Test
- run: npm test
- run: npm run print-available-rules
- run: npm run print-evaluated-rules
# Lint
- run: npm run lint
# Check Changelog
- if: github.repository_owner == 'ni'
run: npm run check
# Publish updates
- name: Set Git User
if: env.HAS_GITHUBPAGESDEPLOYTOKEN == 'true' && startsWith(github.ref, 'refs/heads/main')
run: |
git config --global user.name "${{ env.GITHUB_SERVICE_USER }}"
git config --global user.email "${{ env.GITHUB_SERVICE_EMAIL }}"
- if: env.HAS_GITHUBPAGESDEPLOYTOKEN == 'true' && env.HAS_NPM_TOKEN == 'true' && startsWith(github.ref, 'refs/heads/main')
env:
NPM_SECRET_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run publish:ci -- -n $NPM_SECRET_TOKEN