-
-
Notifications
You must be signed in to change notification settings - Fork 22
129 lines (108 loc) · 3.38 KB
/
Copy pathrelease.yml
File metadata and controls
129 lines (108 loc) · 3.38 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
name: "Release: MCP Bundle and MCP server"
run-name: Release ${{ github.ref_name }}
on:
workflow_dispatch:
env:
PACKAGE_PATTERN: bear-notes-mcpb-*.mcpb
CI: true
jobs:
verify-ci:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Verify release does not exist
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "${{ github.ref_name }}" --repo=${{ github.repository }} &>/dev/null; then
echo "::error::Release ${{ github.ref_name }} already exists"
exit 1
fi
- name: Verify CI passed for tag
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "Checking CI status for tag: ${{ github.ref_name }}"
COUNT=$(gh run list \
--repo=${{ github.repository }} \
--workflow=ci.yml \
--branch=${{ github.ref_name }} \
--status=success \
--limit=1 \
--json conclusion \
--jq 'length')
if [ "$COUNT" -eq 0 ]; then
echo "::error::CI workflow has not passed for tag ${{ github.ref_name }}"
exit 1
fi
echo "CI passed for tag ${{ github.ref_name }}"
release:
needs: verify-ci
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Install Task
uses: arduino/setup-task@v2
- name: Install dependencies
run: npm ci
- name: Create package
run: |
task pack
PACKAGE_FILE=$(ls bear-notes-mcpb-*.mcpb)
echo "PACKAGE_FILE=$PACKAGE_FILE" >> $GITHUB_ENV
- name: Extract changelog
run: |
VERSION=${TAG_NAME#v}
CHANGELOG_BODY=$(task changelog VERSION=$VERSION)
echo "CHANGELOG_BODY<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG_BODY" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
env:
TAG_NAME: ${{ github.ref_name }}
- name: Create Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
body: |
${{ env.CHANGELOG_BODY }}
---
Download ${{ env.PACKAGE_FILE }} to install the extension.
files: ${{ env.PACKAGE_FILE }}
npm-publish:
needs: verify-ci
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Verify version matches tag
run: |
TAG_VERSION=${TAG_NAME#v}
PKG_VERSION=$(node -p "require('./package.json').version")
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "::error::Tag v$TAG_VERSION doesn't match package.json version $PKG_VERSION"
exit 1
fi
echo "Version verified: $PKG_VERSION"
env:
TAG_NAME: ${{ github.ref_name }}
- name: Install dependencies
run: npm ci
- name: Publish to npm
run: npm publish --provenance