-
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (108 loc) · 2.96 KB
/
Copy pathci.yml
File metadata and controls
110 lines (108 loc) · 2.96 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: 'ci'
on:
push:
branches:
- '**'
- '!renovate/**'
paths-ignore:
- README.md
pull_request:
branches:
- '**'
workflow_dispatch:
inputs:
deploy_type:
description: 'Deployment type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
name: Build and Test
steps:
- uses: actions/checkout@v5
with:
submodules: true
- uses: actions/setup-node@v5
with:
node-version: 22
cache: 'npm'
- run: npm install
- run: npm run build
- run: npm run format:check
- run: npm run lint
- run: npm run test:unit
release:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: write # Required to push tags and commits
id-token: write # Required for provenance
steps:
- uses: actions/checkout@v5
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v5
with:
node-version: 'lts/*' # Use LTS for publishing
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- run: npm install
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create Release Commit and Tag
run: npm run release
- name: Push Release Commit and Tag
run: git push --follow-tags origin main
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
deploy:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v5
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v5
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- run: npm install
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Automated Deployment
run: |
npm run build
npm run format
npm run lint:fix
npm run release
git add .
git commit -m "chore: automated deployment $(date +'%Y-%m-%d %H:%M:%S')" || echo "No changes to commit"
git push origin main
git push origin --tags || echo "No tags to push"
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}