-
Notifications
You must be signed in to change notification settings - Fork 1
208 lines (174 loc) · 5.54 KB
/
release.yml
File metadata and controls
208 lines (174 loc) · 5.54 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Release Pipeline
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 2.0.2)'
required: true
type: string
jobs:
# Prepare Release
prepare:
runs-on: ubuntu-latest
name: Prepare Release
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Validate version format
run: |
VERSION="${{ steps.version.outputs.version }}"
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format: $VERSION"
exit 1
fi
# Build Release
build:
runs-on: ubuntu-latest
name: Build Release
needs: prepare
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build project
run: npm run build
- name: Update package version
run: |
npm version ${{ needs.prepare.outputs.version }} --no-git-tag-version
cat package.json | grep version
- name: Create package
run: npm pack
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: npm-package
path: sheikh-cli-*.tgz
# Publish to NPM
publish-npm:
runs-on: ubuntu-latest
name: Publish to NPM
needs: [prepare, build]
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Download package
uses: actions/download-artifact@v4
with:
name: npm-package
- name: Install dependencies
run: npm ci
- name: Update package version
run: npm version ${{ needs.prepare.outputs.version }} --no-git-tag-version
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Verify publication
run: |
echo "Verifying package publication..."
npm view @codienters/sheikh-cli@${{ needs.prepare.outputs.version }}
# Create GitHub Release
create-release:
runs-on: ubuntu-latest
name: Create GitHub Release
needs: [prepare, build]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download package
uses: actions/download-artifact@v4
with:
name: npm-package
- name: Generate changelog
id: changelog
run: |
echo "Generating changelog for version ${{ needs.prepare.outputs.version }}..."
CHANGELOG=$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 HEAD^)..HEAD 2>/dev/null || echo "- Initial release")
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.prepare.outputs.tag }}
release_name: Sheikh-CLI v${{ needs.prepare.outputs.version }}
body: |
## Sheikh-CLI v${{ needs.prepare.outputs.version }}
### 🚀 Installation
```bash
npm install -g @codienters/sheikh-cli
```
### 📋 Changes
${{ steps.changelog.outputs.changelog }}
### 🔧 Usage
```bash
sheikh chat
sheikh config --init
sheikh agents --list
```
### 📚 Documentation
- [README](https://github.com/codienters/sheikh-cli#readme)
- [Agents Guide](https://github.com/codienters/sheikh-cli/blob/main/AGENTS.md)
- [Changelog](https://github.com/codienters/sheikh-cli/blob/main/CHANGELOG.md)
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sheikh-cli-*.tgz
asset_name: sheikh-cli-${{ needs.prepare.outputs.version }}.tgz
asset_content_type: application/gzip
# Notify Success
notify:
runs-on: ubuntu-latest
name: Notify Success
needs: [publish-npm, create-release]
if: always()
steps:
- name: Release Success Notification
run: |
echo "🎉 Release v${{ needs.prepare.outputs.version }} completed successfully!"
echo "📦 Published to NPM: @codienters/sheikh-cli@${{ needs.prepare.outputs.version }}"
echo "🏷️ Created GitHub Release: ${{ needs.prepare.outputs.tag }}"