Skip to content

Commit 45d0baf

Browse files
authored
chore: release v0.1.0 (#1871)
2 parents be21311 + 70c10a9 commit 45d0baf

File tree

25 files changed

+946
-46
lines changed

25 files changed

+946
-46
lines changed

.github/workflows/autofix.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626

2727
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
2828
name: 🟧 Install pnpm
29-
with:
30-
cache: true
3129

3230
- name: 📦 Install dependencies
3331
run: pnpm install

.github/workflows/chromatic.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ jobs:
3232

3333
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
3434
name: 🟧 Install pnpm
35-
with:
36-
cache: true
3735

3836
- name: 📦 Install dependencies
3937
run: pnpm install

.github/workflows/ci.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
branches:
66
- main
7+
- release
78
push:
89
branches:
910
- main
@@ -33,8 +34,6 @@ jobs:
3334

3435
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
3536
name: 🟧 Install pnpm
36-
with:
37-
cache: true
3837

3938
- name: 📦 Install dependencies (root only, no scripts)
4039
run: pnpm install --filter . --ignore-scripts
@@ -55,8 +54,6 @@ jobs:
5554

5655
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
5756
name: 🟧 Install pnpm
58-
with:
59-
cache: true
6057

6158
- name: 📦 Install dependencies
6259
run: pnpm install
@@ -77,8 +74,6 @@ jobs:
7774

7875
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
7976
name: 🟧 Install pnpm
80-
with:
81-
cache: true
8277

8378
- name: 📦 Install dependencies
8479
run: pnpm install
@@ -105,8 +100,6 @@ jobs:
105100

106101
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
107102
name: 🟧 Install pnpm
108-
with:
109-
cache: true
110103

111104
- name: 📦 Install dependencies
112105
run: pnpm install
@@ -144,8 +137,6 @@ jobs:
144137

145138
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
146139
name: 🟧 Install pnpm
147-
with:
148-
cache: true
149140

150141
- name: 📦 Install dependencies
151142
run: pnpm install
@@ -174,8 +165,6 @@ jobs:
174165

175166
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
176167
name: 🟧 Install pnpm
177-
with:
178-
cache: true
179168

180169
- name: 📦 Install dependencies
181170
run: pnpm install
@@ -202,8 +191,6 @@ jobs:
202191

203192
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
204193
name: 🟧 Install pnpm
205-
with:
206-
cache: true
207194

208195
- name: 📦 Install dependencies
209196
run: pnpm install
@@ -227,8 +214,6 @@ jobs:
227214

228215
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
229216
name: 🟧 Install pnpm
230-
with:
231-
cache: true
232217

233218
- name: 📦 Install dependencies (root only, no scripts)
234219
run: pnpm install --filter . --ignore-scripts

.github/workflows/lunaria.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ jobs:
3434

3535
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # 4e1c8eafbd745f64b1ef30a7d7ed7965034c486c
3636
name: 🟧 Install pnpm
37-
with:
38-
cache: true
3937

4038
- name: 📦 Install dependencies
4139
run: pnpm install

.github/workflows/release-pr.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: release-pr
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
jobs:
13+
release-pr:
14+
name: 🚀 Create or update release PR
15+
runs-on: ubuntu-slim
16+
if: github.repository == 'npmx-dev/npmx.dev'
17+
18+
steps:
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: 🔍 Check for unreleased commits
24+
id: check
25+
run: |
26+
git fetch origin release
27+
COMMITS=$(git log origin/release..origin/main --oneline)
28+
if [ -z "$COMMITS" ]; then
29+
echo "skip=true" >> "$GITHUB_OUTPUT"
30+
echo "No new commits to release"
31+
else
32+
echo "skip=false" >> "$GITHUB_OUTPUT"
33+
echo "Found unreleased commits:"
34+
echo "$COMMITS"
35+
fi
36+
37+
- name: 📝 Generate changelog body
38+
if: steps.check.outputs.skip == 'false'
39+
id: changelog
40+
run: |
41+
# Get the latest tag, or use initial commit if no tags exist
42+
LATEST_TAG=$(git describe --tags --abbrev=0 origin/release 2>/dev/null || echo "")
43+
44+
if [ -z "$LATEST_TAG" ]; then
45+
FROM_REF=$(git rev-list --max-parents=0 HEAD)
46+
CURRENT_VERSION="0.0.0"
47+
else
48+
FROM_REF="$LATEST_TAG"
49+
CURRENT_VERSION="${LATEST_TAG#v}"
50+
fi
51+
52+
# Categorize commits
53+
FEATURES=""
54+
FIXES=""
55+
CHORES=""
56+
OTHER=""
57+
58+
while IFS= read -r line; do
59+
[ -z "$line" ] && continue
60+
SHA=$(echo "$line" | cut -d' ' -f1)
61+
MSG=$(echo "$line" | cut -d' ' -f2-)
62+
ENTRY="- $MSG (\`$SHA\`)"
63+
64+
if echo "$MSG" | grep -qE '^feat(\(|:)'; then
65+
FEATURES="${FEATURES}${ENTRY}\n"
66+
elif echo "$MSG" | grep -qE '^fix(\(|:)'; then
67+
FIXES="${FIXES}${ENTRY}\n"
68+
elif echo "$MSG" | grep -qE '^(chore|ci|build|perf|refactor|style|test|docs)(\(|:)'; then
69+
CHORES="${CHORES}${ENTRY}\n"
70+
else
71+
OTHER="${OTHER}${ENTRY}\n"
72+
fi
73+
done <<< "$(git log "$FROM_REF"..origin/main --oneline --no-merges)"
74+
75+
# Determine next version
76+
HAS_BREAKING=$(git log "$FROM_REF"..origin/main --format='%B' | grep -c 'BREAKING CHANGE\|!:' || true)
77+
HAS_FEAT=$(git log "$FROM_REF"..origin/main --oneline --no-merges | grep -cE '^[a-f0-9]+ feat(\(|:)' || true)
78+
79+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
80+
81+
if [ "$HAS_BREAKING" -gt 0 ] && [ "$MAJOR" -gt 0 ]; then
82+
NEXT_VERSION="$((MAJOR + 1)).0.0"
83+
elif [ "$HAS_FEAT" -gt 0 ]; then
84+
NEXT_VERSION="${MAJOR}.$((MINOR + 1)).0"
85+
else
86+
NEXT_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
87+
fi
88+
89+
echo "next_version=v${NEXT_VERSION}" >> "$GITHUB_OUTPUT"
90+
91+
# Build the PR body
92+
BODY="This PR will deploy the following changes to production (\`npmx.dev\`).\n\n"
93+
BODY="${BODY}**Next version: \`v${NEXT_VERSION}\`** (current: \`v${CURRENT_VERSION}\`)\n\n"
94+
95+
if [ -n "$FEATURES" ]; then
96+
BODY="${BODY}### Features\n\n${FEATURES}\n"
97+
fi
98+
if [ -n "$FIXES" ]; then
99+
BODY="${BODY}### Fixes\n\n${FIXES}\n"
100+
fi
101+
if [ -n "$CHORES" ]; then
102+
BODY="${BODY}### Other Changes\n\n${CHORES}\n"
103+
fi
104+
if [ -n "$OTHER" ]; then
105+
BODY="${BODY}### Uncategorized\n\n${OTHER}\n"
106+
fi
107+
108+
BODY="${BODY}---\n\n"
109+
BODY="${BODY}> Merging this PR will:\n"
110+
BODY="${BODY}> - Deploy to \`npmx.dev\` via Vercel\n"
111+
BODY="${BODY}> - Create a \`v${NEXT_VERSION}\` tag and GitHub Release\n"
112+
BODY="${BODY}> - Publish \`npmx-connector@${NEXT_VERSION}\` to npm"
113+
114+
# Write body to file, truncating if needed (GitHub limits PR body to 65536 chars)
115+
echo -e "$BODY" > /tmp/pr-body.md
116+
if [ "$(wc -c < /tmp/pr-body.md)" -gt 60000 ]; then
117+
COMMIT_COUNT=$(git log "$FROM_REF"..origin/main --oneline --no-merges | wc -l)
118+
COMPARE_URL="https://github.com/npmx-dev/npmx.dev/compare/${FROM_REF}...main"
119+
TRUNCATED="This PR will deploy the following changes to production (\`npmx.dev\`).\n\n"
120+
TRUNCATED="${TRUNCATED}**Next version: \`v${NEXT_VERSION}\`** (current: \`v${CURRENT_VERSION}\`)\n\n"
121+
TRUNCATED="${TRUNCATED}> **${COMMIT_COUNT} commits** are included in this release. The full changelog is too large to display here.\n>\n"
122+
TRUNCATED="${TRUNCATED}> [View full diff on GitHub](${COMPARE_URL})\n\n"
123+
TRUNCATED="${TRUNCATED}---\n\n"
124+
TRUNCATED="${TRUNCATED}> Merging this PR will:\n"
125+
TRUNCATED="${TRUNCATED}> - Deploy to \`npmx.dev\` via Vercel\n"
126+
TRUNCATED="${TRUNCATED}> - Create a \`v${NEXT_VERSION}\` tag and GitHub Release\n"
127+
TRUNCATED="${TRUNCATED}> - Publish \`npmx-connector@${NEXT_VERSION}\` to npm"
128+
echo -e "$TRUNCATED" > /tmp/pr-body.md
129+
fi
130+
131+
- name: 🚀 Create or update release PR
132+
if: steps.check.outputs.skip == 'false'
133+
env:
134+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
NEXT_VERSION: ${{ steps.changelog.outputs.next_version }}
136+
run: |
137+
EXISTING_PR=$(gh pr list --base release --head main --state open --json number --jq '.[0].number')
138+
139+
if [ -n "$EXISTING_PR" ]; then
140+
gh pr edit "$EXISTING_PR" \
141+
--title "chore: release ${NEXT_VERSION}" \
142+
--body-file /tmp/pr-body.md
143+
echo "Updated existing PR #${EXISTING_PR}"
144+
else
145+
gh pr create \
146+
--base release \
147+
--head main \
148+
--title "chore: release ${NEXT_VERSION}" \
149+
--body-file /tmp/pr-body.md \
150+
--label "release"
151+
echo "Created new release PR"
152+
fi

0 commit comments

Comments
 (0)