Skip to content

Commit 1ad4e20

Browse files
committed
chore: tag version v0.0.2
1 parent f15b4f8 commit 1ad4e20

File tree

3 files changed

+94
-11
lines changed

3 files changed

+94
-11
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,33 @@ jobs:
3838
fi
3939
echo "Tag format is valid: ${{ github.ref_name }}"
4040
41+
- name: Check for existing release
42+
id: check_release
43+
run: |
44+
TAG="${{ github.ref_name }}"
45+
echo "Checking for existing release with tag $TAG"
46+
47+
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
48+
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG" | \
49+
jq -r '.id // "null"')
50+
51+
if [ "$RELEASE_ID" != "null" ]; then
52+
echo "Existing release found with ID: $RELEASE_ID"
53+
echo "release_exists=true" >> $GITHUB_OUTPUT
54+
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
55+
else
56+
echo "No existing release found for tag $TAG"
57+
echo "release_exists=false" >> $GITHUB_OUTPUT
58+
fi
59+
60+
- name: Delete existing release
61+
if: steps.check_release.outputs.release_exists == 'true'
62+
run: |
63+
echo "Deleting existing release with ID: ${{ steps.check_release.outputs.release_id }}"
64+
curl -s -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
65+
"https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.check_release.outputs.release_id }}"
66+
echo "Existing release deleted successfully"
67+
4168
- name: Build rules
4269
id: build
4370
run: |
@@ -97,3 +124,6 @@ jobs:
97124
token: ${{ secrets.GITHUB_TOKEN }}
98125
name: "Cursor Rules ${{ github.ref_name }}"
99126
fail_on_unmatched_files: true
127+
draft: false
128+
prerelease: false
129+
generate_release_notes: false

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zackiles/cursor-config",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "An opinionated suite of general-purpose, and modern Cursor Rules as well as global Cursor configuration that compliments these rules.",
55
"license": "MIT",
66
"author": "Zachary Iles <zack.iles@gmail.com>",

install.sh

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ print_message() {
1818
check_dependencies() {
1919
local missing_deps=()
2020

21-
for cmd in curl unzip grep cut; do
21+
for cmd in curl unzip grep cut jq; do
2222
if ! command -v "$cmd" >/dev/null 2>&1; then
2323
missing_deps+=("$cmd")
2424
fi
@@ -53,18 +53,70 @@ cleanup() {
5353
trap cleanup EXIT
5454
trap 'print_message "Installation aborted." "${RED}"; exit 1' INT TERM
5555

56-
# Get the latest release
57-
print_message "Fetching latest release information..." "${BLUE}"
58-
LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest | grep "browser_download_url.*zip" | cut -d '"' -f 4)
56+
# Retrieve all releases
57+
print_message "Fetching release information..." "${BLUE}"
58+
ALL_RELEASES=$(curl -s "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases")
5959

60-
if [ -z "$LATEST_RELEASE_URL" ]; then
61-
print_message "Error: Could not find the latest release. Please check your internet connection and try again." "${RED}"
60+
# Check if we got a valid JSON response
61+
if ! echo "$ALL_RELEASES" | jq empty 2>/dev/null; then
62+
print_message "Error: Failed to fetch releases. GitHub API response is not valid JSON." "${RED}"
63+
print_message "Response: ${ALL_RELEASES}" "${RED}"
6264
exit 1
6365
fi
6466

65-
print_message "Downloading latest release from $LATEST_RELEASE_URL" "${BLUE}"
66-
if ! curl -sL "$LATEST_RELEASE_URL" -o "$TEMP_DIR/rules.zip"; then
67-
print_message "Error: Failed to download the release. Please check your internet connection and try again." "${RED}"
67+
# Check if we have any releases
68+
RELEASE_COUNT=$(echo "$ALL_RELEASES" | jq 'length')
69+
if [ "$RELEASE_COUNT" -eq 0 ]; then
70+
print_message "Error: No releases found for $REPO_OWNER/$REPO_NAME." "${RED}"
71+
exit 1
72+
fi
73+
74+
# Get the latest release that has assets
75+
print_message "Finding latest release with assets..." "${BLUE}"
76+
77+
# Find the first release with a rules.zip asset
78+
DOWNLOAD_URL=""
79+
for i in $(seq 0 $((RELEASE_COUNT-1))); do
80+
ASSETS=$(echo "$ALL_RELEASES" | jq -r ".[$i].assets")
81+
ASSET_COUNT=$(echo "$ASSETS" | jq 'length')
82+
83+
if [ "$ASSET_COUNT" -gt 0 ]; then
84+
for j in $(seq 0 $((ASSET_COUNT-1))); do
85+
NAME=$(echo "$ASSETS" | jq -r ".[$j].name")
86+
if [ "$NAME" == "rules.zip" ]; then
87+
DOWNLOAD_URL=$(echo "$ASSETS" | jq -r ".[$j].browser_download_url")
88+
RELEASE_NAME=$(echo "$ALL_RELEASES" | jq -r ".[$i].name")
89+
RELEASE_TAG=$(echo "$ALL_RELEASES" | jq -r ".[$i].tag_name")
90+
break 2
91+
fi
92+
done
93+
fi
94+
done
95+
96+
if [ -z "$DOWNLOAD_URL" ]; then
97+
print_message "Error: No rules.zip asset found in any release." "${RED}"
98+
exit 1
99+
fi
100+
101+
print_message "Found release: ${RELEASE_NAME:-Unnamed} (${RELEASE_TAG:-Untagged})" "${BLUE}"
102+
print_message "Downloading from: $DOWNLOAD_URL" "${BLUE}"
103+
104+
HTTP_CODE=$(curl -s -L -w "%{http_code}" -o "$TEMP_DIR/rules.zip" "$DOWNLOAD_URL")
105+
106+
# Check if the download succeeded
107+
if [ "$HTTP_CODE" != "200" ]; then
108+
print_message "Error: Failed to download rules.zip (HTTP code: $HTTP_CODE). Please check your internet connection and try again." "${RED}"
109+
exit 1
110+
fi
111+
112+
# Check if the file is empty or contains "Not Found"
113+
if [ ! -s "$TEMP_DIR/rules.zip" ]; then
114+
print_message "Error: The downloaded file is empty." "${RED}"
115+
exit 1
116+
fi
117+
118+
if grep -q "Not Found" "$TEMP_DIR/rules.zip"; then
119+
print_message "Error: The downloaded file contains 'Not Found'. The asset may not exist." "${RED}"
68120
exit 1
69121
fi
70122

@@ -75,9 +127,10 @@ if ! unzip -q "$TEMP_DIR/rules.zip" -d "$TEMP_DIR"; then
75127
exit 1
76128
fi
77129

78-
# Verify that we have extracted files (check for MDC files instead of rules.json)
130+
# Verify that we have extracted files (check for MDC files)
79131
if [ $(ls -1 "$TEMP_DIR"/*.mdc 2>/dev/null | wc -l) -eq 0 ]; then
80132
print_message "Error: Invalid release package. No rule files found." "${RED}"
133+
ls -la "$TEMP_DIR" | head -n 20
81134
exit 1
82135
fi
83136

0 commit comments

Comments
 (0)