-
-
Notifications
You must be signed in to change notification settings - Fork 1
183 lines (145 loc) · 6.4 KB
/
release.yml
File metadata and controls
183 lines (145 loc) · 6.4 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
name: Create Release
# Disabled - releases created manually via gh CLI
# Re-enable by uncommenting the 'on:' section below
# on:
# push:
# tags:
# - 'v*.*.*'
on:
workflow_dispatch: # Manual trigger only
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
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
cache: 'npm'
- name: Extract version from tag
id: version
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Verify version matches package.json
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION=${{ steps.version.outputs.version }}
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
echo "❌ Version mismatch!"
echo " package.json: $PACKAGE_VERSION"
echo " Git tag: $TAG_VERSION"
exit 1
fi
echo "✅ Version matches: $PACKAGE_VERSION"
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Create distribution tarball
run: npm pack
- name: Generate changelog from commits
id: changelog
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -z "$PREVIOUS_TAG" ]; then
echo "First release - generating full changelog"
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --reverse)
else
echo "Generating changelog from $PREVIOUS_TAG to ${{ steps.version.outputs.tag }}"
CHANGELOG=$(git log $PREVIOUS_TAG..${{ steps.version.outputs.tag }} --pretty=format:"- %s (%h)")
fi
# Save to file to handle multiline
echo "$CHANGELOG" > CHANGELOG.txt
echo "Generated changelog:"
cat CHANGELOG.txt
- name: Create release notes
run: |
cat > RELEASE_NOTES.md << 'EOF'
# Cerber Core ${{ steps.version.outputs.version }}
## 🚀 Installation
```bash
npm install cerber-core@${{ steps.version.outputs.version }}
```
## 📦 What's Included
- **🛡️ Guardian 1.0** - Pre-commit architecture validator
- **🔍 Cerber 2.1** - Runtime health diagnostics
- **⚡ SOLO** - Automation for solo developers (9 scripts)
- **👥 TEAM** - Focus Mode for large codebases (500 LOC context)
## 📝 Changes in This Release
EOF
cat CHANGELOG.txt >> RELEASE_NOTES.md
cat >> RELEASE_NOTES.md << 'EOF'
## 📚 Documentation
- [README](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/README.md)
- [User Journey](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/USER_JOURNEY.md)
- [SOLO Guide](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/docs/SOLO.md)
- [TEAM Guide](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/docs/TEAM.md)
- [Security Policy](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/SECURITY.md)
- [Troubleshooting](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.tag }}/docs/TROUBLESHOOTING.md)
## 🔗 Links
- **npm:** https://www.npmjs.com/package/cerber-core
- **GitHub:** https://github.com/${{ github.repository }}
- **Issues:** https://github.com/${{ github.repository }}/issues
- **Discussions:** https://github.com/${{ github.repository }}/discussions
## 💝 Support
If Cerber Core helps your project, consider:
- ⭐ Star the repo
- 💰 [Sponsor on GitHub](https://github.com/sponsors/Agaslez)
- ☕ [Buy me a coffee](https://www.buymeacoffee.com/stefanpitek)
- 📢 Share with your team
## 🙏 Thank You
Thank you to everyone who contributed to this release!
EOF
echo "Release notes:"
cat RELEASE_NOTES.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Cerber Core ${{ steps.version.outputs.version }}
body_path: RELEASE_NOTES.md
draft: false
prerelease: false
files: |
cerber-core-${{ steps.version.outputs.version }}.tgz
LICENSE
README.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger npm publish workflow
uses: actions/github-script@v7
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'publish.yml',
ref: '${{ steps.version.outputs.tag }}',
inputs: {
tag: '${{ steps.version.outputs.tag }}'
}
});
console.log('✅ Triggered npm publish workflow');
- name: Post release summary
run: |
echo "🎉 Release Summary"
echo "=================="
echo ""
echo "✅ Created: ${{ steps.version.outputs.tag }}"
echo "🔗 Release: https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.tag }}"
echo "📦 Tarball: cerber-core-${{ steps.version.outputs.version }}.tgz"
echo ""
echo "Next steps:"
echo " 1. npm publish will run automatically"
echo " 2. Announce on social media"
echo " 3. Update documentation site (if exists)"
echo " 4. Notify sponsors/contributors"