forked from TinyAGI/tinyagi
-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (115 loc) · 4.11 KB
/
release.yml
File metadata and controls
136 lines (115 loc) · 4.11 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
name: Create Release Bundle
on:
push:
tags:
- 'v*.*.*' # Trigger on version tags like v1.0.0
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Get version from tag
id: get_version
run: |
if [ "${{ github.ref_type }}" = "tag" ]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION=$(git describe --tags --always)
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Install dependencies
run: |
PUPPETEER_SKIP_DOWNLOAD=true npm ci --include=dev
- name: Build TypeScript
run: npm run build
- name: Prune development dependencies
run: npm prune --omit=dev
- name: Create bundle tarball
run: |
VERSION="${{ steps.get_version.outputs.version }}"
BUNDLE_NAME="tinyclaw-bundle.tar.gz"
TEMP_DIR=$(mktemp -d)
BUNDLE_DIR="$TEMP_DIR/tinyclaw"
mkdir -p "$BUNDLE_DIR"
# Copy necessary files
cp -r bin/ "$BUNDLE_DIR/"
cp -r src/ "$BUNDLE_DIR/"
cp -r dist/ "$BUNDLE_DIR/"
cp -r node_modules/ "$BUNDLE_DIR/"
cp -r scripts/ "$BUNDLE_DIR/"
cp -r lib/ "$BUNDLE_DIR/"
cp -r docs/ "$BUNDLE_DIR/"
cp -r .agents/ "$BUNDLE_DIR/"
cp tinyclaw.sh "$BUNDLE_DIR/"
cp package.json "$BUNDLE_DIR/"
cp package-lock.json "$BUNDLE_DIR/"
cp tsconfig.json "$BUNDLE_DIR/"
cp tsconfig.visualizer.json "$BUNDLE_DIR/"
cp README.md "$BUNDLE_DIR/"
cp AGENTS.md "$BUNDLE_DIR/"
cp SOUL.md "$BUNDLE_DIR/"
cp heartbeat.md "$BUNDLE_DIR/"
cp .gitignore "$BUNDLE_DIR/"
# Make scripts executable
chmod +x "$BUNDLE_DIR/bin/tinyclaw"
chmod +x "$BUNDLE_DIR/tinyclaw.sh"
chmod +x "$BUNDLE_DIR/scripts/install.sh"
chmod +x "$BUNDLE_DIR/scripts/uninstall.sh"
chmod +x "$BUNDLE_DIR/scripts/bundle.sh"
chmod +x "$BUNDLE_DIR/scripts/remote-install.sh"
chmod +x "$BUNDLE_DIR/lib/setup-wizard.sh"
chmod +x "$BUNDLE_DIR/lib/heartbeat-cron.sh"
chmod +x "$BUNDLE_DIR/lib/update.sh"
# Create tarball
cd "$TEMP_DIR"
tar -czf "$GITHUB_WORKSPACE/$BUNDLE_NAME" tinyclaw/
# Get bundle info
BUNDLE_SIZE=$(du -h "$GITHUB_WORKSPACE/$BUNDLE_NAME" | cut -f1)
echo "Bundle created: $BUNDLE_NAME ($BUNDLE_SIZE)"
echo "bundle_name=$BUNDLE_NAME" >> $GITHUB_OUTPUT
echo "bundle_size=$BUNDLE_SIZE" >> $GITHUB_OUTPUT
- name: Extract release notes from tag
id: release_notes
run: |
VERSION="${{ steps.get_version.outputs.version }}"
# Use for-each-ref to reliably get the annotated tag message (not the commit message)
TAG_MESSAGE=$(git for-each-ref --format='%(contents)' "refs/tags/$VERSION")
if [ -n "$TAG_MESSAGE" ]; then
echo "$TAG_MESSAGE" > release_notes.md
else
cat > release_notes.md <<EOF
## TinyClaw $VERSION
See commits since last release for detailed changes.
EOF
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
if: github.ref_type == 'tag'
with:
body_path: release_notes.md
files: |
tinyclaw-bundle.tar.gz
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact (for non-tag builds)
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: tinyclaw-bundle
path: tinyclaw-bundle.tar.gz
retention-days: 7