-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (93 loc) · 3.98 KB
/
Copy pathbuild.yml
File metadata and controls
107 lines (93 loc) · 3.98 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
name: Build Cursor ARM64 RPM
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 1' # Weekly Monday 06:00 UTC
jobs:
check-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check latest Cursor version
id: version
run: |
# Follow redirect to get filename with version
FILENAME=$(curl -sD - -o /dev/null \
"https://api2.cursor.sh/updates/download/golden/linux-x64/cursor/latest" \
| grep -i 'location:' | tail -1 \
| grep -oP 'Cursor-\K[0-9]+\.[0-9]+\.[0-9]+')
if [ -z "$FILENAME" ]; then
# Fallback: download and extract from product.json
curl -Lo /tmp/cursor.AppImage \
"https://api2.cursor.sh/updates/download/golden/linux-x64/cursor/latest"
OFFSET=$(grep -aobP 'hsqs' /tmp/cursor.AppImage | tail -1 | cut -d: -f1)
sudo unsquashfs -o "$OFFSET" -d /tmp/sq /tmp/cursor.AppImage
if [ -f /tmp/sq/usr/share/cursor/resources/app/product.json ]; then
FILENAME=$(python3 -c "import json; print(json.load(open('/tmp/sq/usr/share/cursor/resources/app/product.json'))['version'])")
else
FILENAME=$(python3 -c "import json; print(json.load(open('/tmp/sq/resources/app/product.json'))['version'])")
fi
fi
echo "cursor_version=$FILENAME" >> "$GITHUB_OUTPUT"
echo "Latest Cursor version: $FILENAME"
- name: Check if already built
id: check
run: |
VERSION="${{ steps.version.outputs.cursor_version }}"
if gh release view "v$VERSION" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "Version $VERSION already released, skipping."
else
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "New version $VERSION, building."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
if: steps.check.outputs.skip == 'false'
run: |
sudo apt-get update
sudo apt-get install -y squashfs-tools rpm createrepo-c
- name: Build Cursor ARM64
if: steps.check.outputs.skip == 'false'
run: |
chmod +x build-cursor-arm64.sh
./build-cursor-arm64.sh
- name: Build RPM
if: steps.check.outputs.skip == 'false'
run: |
chmod +x build-rpm.sh
./build-rpm.sh
- name: Create GitHub Release
if: steps.check.outputs.skip == 'false'
run: |
VERSION="${{ steps.version.outputs.cursor_version }}"
RPM_PATH=$(cat /tmp/cursor-build/out/rpm-path.txt)
gh release create "v$VERSION" "$RPM_PATH" \
--title "Cursor $VERSION ARM64" \
--notes "Cursor $VERSION — unofficial native ARM64 RPM build.
Built by grafting Cursor's proprietary JS onto open-source VS Code ARM64."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to Cloudflare R2
if: steps.check.outputs.skip == 'false'
run: |
RPM_PATH=$(cat /tmp/cursor-build/out/rpm-path.txt)
RPM_NAME=$(basename "$RPM_PATH")
# Download existing repodata to merge
mkdir -p /tmp/netsnek-repo
cp "$RPM_PATH" /tmp/netsnek-repo/
# Also fetch existing RPMs metadata for complete repodata
# We only need the new RPM in the dir — createrepo will index it
createrepo_c /tmp/netsnek-repo/
# Upload RPM
npx wrangler r2 object put "netsnek-rpm/$RPM_NAME" \
--file="$RPM_PATH" --remote
# Upload repodata
for f in /tmp/netsnek-repo/repodata/*; do
npx wrangler r2 object put "netsnek-rpm/repodata/$(basename "$f")" \
--file="$f" --remote
done
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}