-
Notifications
You must be signed in to change notification settings - Fork 24
201 lines (164 loc) · 6.64 KB
/
release.yml
File metadata and controls
201 lines (164 loc) · 6.64 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
name: Create Release
on:
push:
branches:
- main
paths:
- 'package.json'
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read version information
id: version
run: |
VERSION=$(jq -r '.version' package.json)
N8N_VERSION=$(jq -r '.dependencies["n8n"]' package.json | sed 's/\^//')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "n8n_version=$N8N_VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
echo "Skill pack version: $VERSION"
echo "n8n version: v$N8N_VERSION"
- name: Check if tag already exists
id: check_tag
run: |
TAG="${{ steps.version.outputs.tag }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Tag $TAG already exists, skipping release creation"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Tag $TAG does not exist, proceeding with release creation"
fi
- name: Setup Node.js
if: steps.check_tag.outputs.exists == 'false'
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
env:
NODE_OPTIONS: --max-old-space-size=4096
- name: Install dependencies
if: steps.check_tag.outputs.exists == 'false'
run: npm ci
- name: Verify cache files exist
if: steps.check_tag.outputs.exists == 'false'
run: |
# Cache is prebuilt locally and committed to avoid CI segfault (exit code 139)
# Rebuilding in CI causes memory issues when loading n8n native modules
if [ ! -f "data/cache/nodes.json" ]; then
echo "❌ Error: data/cache/nodes.json not found"
echo "Please run 'npm run build:full' locally and commit cache files"
exit 1
fi
if [ ! -f "data/cache/properties.json" ]; then
echo "❌ Error: data/cache/properties.json not found"
echo "Please run 'npm run build:full' locally and commit cache files"
exit 1
fi
echo "✅ Cache files exist (prebuilt locally to avoid CI segfault)"
echo " - nodes.json: $(du -h data/cache/nodes.json | cut -f1)"
echo " - properties.json: $(du -h data/cache/properties.json | cut -f1)"
echo " - templates.json: $(du -h data/cache/templates.json 2>/dev/null | cut -f1 || echo 'not found')"
echo " - usage-stats.json: $(du -h data/cache/usage-stats.json 2>/dev/null | cut -f1 || echo 'not found')"
- name: Build project and generate output
if: steps.check_tag.outputs.exists == 'false'
run: npm run build:full
env:
NODE_ENV: production
NODE_OPTIONS: --max-old-space-size=4096 --expose-gc
CI: true
- name: Verify output directory
if: steps.check_tag.outputs.exists == 'false'
run: |
if [ ! -d "output" ]; then
echo "Error: output directory does not exist"
exit 1
fi
if [ ! -f "output/SKILL.md" ]; then
echo "Error: output/SKILL.md file does not exist"
exit 1
fi
echo "Output directory verification passed"
ls -lh output/
- name: Package skill pack
if: steps.check_tag.outputs.exists == 'false'
working-directory: output
run: |
# Create zip file, SKILL.md will be in root
zip -r n8n-skills-${{ steps.version.outputs.version }}.zip .
# Display zip contents
echo "Zip file contents:"
unzip -l n8n-skills-${{ steps.version.outputs.version }}.zip | head -20
# Move to parent directory
mv n8n-skills-${{ steps.version.outputs.version }}.zip ../
echo "Packaging complete"
- name: Check file size
if: steps.check_tag.outputs.exists == 'false'
run: |
ZIP_FILE="n8n-skills-${{ steps.version.outputs.version }}.zip"
SIZE=$(wc -c < "$ZIP_FILE")
SIZE_MB=$((SIZE / 1024 / 1024))
echo "Zip file size: ${SIZE_MB} MB"
if [ $SIZE_MB -gt 50 ]; then
echo "Warning: File exceeds 50MB, may affect download speed"
fi
- name: Generate Release Notes
if: steps.check_tag.outputs.exists == 'false'
id: release_notes
run: |
# Get recent commits
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$LAST_TAG" ]; then
COMMITS=$(git log ${LAST_TAG}..HEAD --oneline --no-merges)
else
COMMITS=$(git log --oneline --no-merges -n 10)
fi
# Create Release Notes
cat > release-notes.md << EOF
## n8n Skill Pack v${{ steps.version.outputs.version }}
Supports n8n version: v${{ steps.version.outputs.n8n_version }}
### Updates
$COMMITS
### Usage
1. Download \`n8n-skills-${{ steps.version.outputs.version }}.zip\`
2. Extract to your project directory
3. Load the \`SKILL.md\` file in your AI assistant
4. Start exploring n8n node information
### Contents
- Complete n8n node documentation
- Node configuration examples
- Workflow pattern reference
- Category index and search guide
EOF
echo "Release notes generated"
- name: Create Release
if: steps.check_tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.tag }}
name: v${{ steps.version.outputs.version }}
body_path: release-notes.md
files: |
n8n-skills-${{ steps.version.outputs.version }}.zip
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release completion notification
if: steps.check_tag.outputs.exists == 'false'
run: |
echo "Release v${{ steps.version.outputs.version }} created successfully"
echo "Download link: https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.tag }}"
- name: Tag exists notification
if: steps.check_tag.outputs.exists == 'true'
run: |
echo "Tag ${{ steps.version.outputs.tag }} already exists, skipping release creation"
echo "To recreate release, delete the existing tag first"