-
Notifications
You must be signed in to change notification settings - Fork 2
143 lines (117 loc) · 4.57 KB
/
Copy pathrelease.yml
File metadata and controls
143 lines (117 loc) · 4.57 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Release and Publish
on:
push:
branches: [main, load-docs]
permissions:
contents: write
packages: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
with:
version: 10.32.1
- name: Setup Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: "22"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Install platform-specific dependencies
run: |
# Install platform dependencies for Linux (temporary, not saved to package.json)
pnpm add @oxlint/linux-x64-gnu --save-dev || echo "Failed to install oxlint platform dependency, continuing..."
- name: Check formatting
run: pnpm run format:check:all
- name: Run linting
run: pnpm run lint:all
- name: Build project
run: pnpm run build
- name: Run tests
run: pnpm test
env:
LOG_LEVEL: ERROR
release:
needs: test
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App Token
id: generate_token
uses: tibdex/github-app-token@32691ba7c9e7063bd457bd8f2a5703138591fa58 # v1
with:
app_id: ${{ vars.VERSION_BUMPER_APPID }}
private_key: ${{ secrets.VERSION_BUMPER_SECRET }}
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
- name: Setup pnpm
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
with:
version: 10.32.1
- name: Setup Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: "22"
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: pnpm install
- name: Install platform-specific dependencies
run: |
# Install platform dependencies for Linux CI environment (temporary, not saved to package.json)
pnpm add @oxlint/linux-x64-gnu --save-dev || echo "Failed to install oxlint platform dependency"
- name: Build project
run: pnpm run build
- name: Bump version and create tag
id: version
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
tag_prefix: v
- name: Update package.json version
if: steps.version.outputs.new_tag
run: |
NEW_VERSION=${{ steps.version.outputs.new_version }}
# Update root package.json
pnpm version $NEW_VERSION --no-git-tag-version
# Update all workspace package versions
pnpm -r exec pnpm version $NEW_VERSION --no-git-tag-version
# Ensure no platform-specific dependencies were accidentally saved
pnpm remove @oxlint/linux-x64-gnu 2>/dev/null || true
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add package.json packages/*/package.json pnpm-lock.yaml
git commit -m "chore: bump version to $NEW_VERSION [skip ci]" || exit 0
git push
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: Create GitHub Release
if: steps.version.outputs.new_tag
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
tag_name: ${{ steps.version.outputs.new_tag }}
name: Release ${{ steps.version.outputs.new_tag }}
body: ${{ steps.version.outputs.changelog }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm
if: steps.version.outputs.new_tag
run: |
# Publish only public packages (those without "private": true)
# Using pnpm publish with --filter to exclude private packages
pnpm --filter '@codemcp/knowledge-server' publish --access public --no-git-checks
pnpm --filter '@codemcp/knowledge' publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}