-
Notifications
You must be signed in to change notification settings - Fork 5
67 lines (53 loc) · 1.7 KB
/
cd.yml
File metadata and controls
67 lines (53 loc) · 1.7 KB
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
65
66
67
name: CD
on:
push:
branches: [main]
permissions:
contents: write
id-token: write
jobs:
build-test-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install deps
run: npm ci
- name: Build
run: npm run build
- name: Run checks (linting, type-checking, formatting)
run: npm run check
- name: Ensure repo is clean after checks
run: git diff --exit-code
- name: Run tests
run: npm run test
- name: Configure git user
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
- name: Bump version locally
run: npm version patch -m "chore(release)"
- name: Debug npm config
run: |
echo "=== .npmrc contents ==="
cat /home/runner/work/_temp/.npmrc || echo "No .npmrc found"
echo "=== npm config list ==="
npm config list
echo "=== Environment variables ==="
env | grep -E "(NPM|NODE)" || echo "No NPM/NODE env vars found"
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push commit and tag (only if publish succeeded)
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git push origin HEAD:main --follow-tags