-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (84 loc) · 2.76 KB
/
Copy pathrelease.yml
File metadata and controls
99 lines (84 loc) · 2.76 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
packages: write
jobs:
build-image:
uses: ./.github/workflows/image-build.yml
with:
build_default_branch_manifest: true
secrets:
GH_TOKEN_USER: ${{ secrets.GH_TOKEN_USER }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
release:
needs: build-image
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Get version from tag
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION=${GITHUB_REF#refs/tags/}
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "version_without_v=${VERSION#v}" >> $GITHUB_OUTPUT
echo "Released version: $VERSION"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run type check
run: pnpm typecheck
- name: Run lint
run: pnpm lint
- name: Update package.json version
run: |
npm version ${{ steps.get_version.outputs.version_without_v }} --no-git-tag-version
echo "Updated package.json to version ${{ steps.get_version.outputs.version_without_v }}"
- name: Publish to npm
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Check version
run: |
echo "Published version: ${{ steps.get_version.outputs.version_without_v }}"
echo "Package.json version: $(node -p "require('./package.json').version")"
echo "npm view version: $(npm view @gbox.ai/mcp-server version)"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
body: |
### Installation
```bash
npm install -g @gbox.ai/mcp-server@${{ steps.get_version.outputs.version_without_v }}
```
### Usage
```json
{
"gbox-android": {
"command": "npx",
"args": ["-y", "@gbox.ai/mcp-server@${{ steps.get_version.outputs.version_without_v }}"]
}
}
```
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}