Skip to content

Commit 3728804

Browse files
committed
Add omnibus GitHub Release workflow
Single workflow triggered by v* tags that creates one unified "Basecamp SDK vX.Y.Z" release with a combined changelog and installation instructions for all five SDKs. Uses AI inference for changelog summarization with a fallback to raw commit list. Independent of the per-SDK publish workflows — the release announcement doesn't gate artifact availability.
1 parent b1fd876 commit 3728804

File tree

1 file changed

+160
-0
lines changed

1 file changed

+160
-0
lines changed
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: Create GitHub Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
models: read
11+
12+
jobs:
13+
release:
14+
name: Create Release
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Verify tag is on main
22+
run: |
23+
git fetch origin main
24+
git merge-base --is-ancestor "$GITHUB_SHA" origin/main
25+
26+
- name: Extract version
27+
id: version
28+
run: |
29+
VERSION="${GITHUB_REF#refs/tags/}"
30+
SEMVER="${VERSION#v}"
31+
echo "version=$VERSION" >> $GITHUB_OUTPUT
32+
echo "semver=$SEMVER" >> $GITHUB_OUTPUT
33+
34+
- name: Build changelog prompt
35+
id: changelog-inputs
36+
run: |
37+
PREV_TAG=$(git describe --tags --match 'v*' --abbrev=0 HEAD^ 2>/dev/null || true)
38+
if [ -z "$PREV_TAG" ]; then
39+
COMMITS=$(git log --pretty=format:"- %s (%h)")
40+
git diff --stat HEAD > /tmp/sdk-diff.txt
41+
else
42+
COMMITS=$(git log --pretty=format:"- %s (%h)" "${PREV_TAG}..HEAD")
43+
git diff --stat "${PREV_TAG}..HEAD" > /tmp/sdk-diff.txt
44+
fi
45+
echo "$COMMITS" > /tmp/commits.txt
46+
47+
{
48+
echo "SDK: All (Go, TypeScript, Ruby, Swift, Kotlin)"
49+
echo "Version: ${{ steps.version.outputs.version }}"
50+
echo ""
51+
echo "Commits since last release:"
52+
cat /tmp/commits.txt
53+
echo ""
54+
echo "Diff (truncated):"
55+
head -c 100000 /tmp/sdk-diff.txt
56+
} > /tmp/user-message.txt
57+
58+
cp .github/prompts/summarize-changelog.prompt.yml /tmp/prompt.yml
59+
python3 -c "
60+
import yaml
61+
with open('/tmp/prompt.yml') as f:
62+
prompt = yaml.safe_load(f)
63+
with open('/tmp/user-message.txt') as f:
64+
user_msg = f.read()
65+
prompt['messages'].append({'role': 'user', 'content': user_msg})
66+
with open('/tmp/prompt.yml', 'w') as f:
67+
yaml.dump(prompt, f, default_flow_style=False, allow_unicode=True)
68+
"
69+
70+
- name: Summarize changes
71+
id: summarize
72+
continue-on-error: true
73+
uses: actions/ai-inference@v1
74+
with:
75+
prompt-file: /tmp/prompt.yml
76+
77+
- name: Write changelog
78+
if: steps.summarize.outcome == 'success'
79+
run: |
80+
VERSION="${{ steps.version.outputs.version }}"
81+
SEMVER="${{ steps.version.outputs.semver }}"
82+
RESPONSE_FILE="${{ steps.summarize.outputs.response-file }}"
83+
{
84+
cat "$RESPONSE_FILE"
85+
echo ""
86+
echo "## Installation"
87+
echo ""
88+
echo "**Go**"
89+
echo '```'
90+
echo "go get github.com/basecamp/basecamp-sdk/go@${VERSION}"
91+
echo '```'
92+
echo ""
93+
echo "**TypeScript**"
94+
echo '```'
95+
echo "npm install @37signals/basecamp@${SEMVER}"
96+
echo '```'
97+
echo ""
98+
echo "**Ruby**"
99+
echo '```'
100+
echo "gem install basecamp-sdk -v ${SEMVER}"
101+
echo '```'
102+
echo ""
103+
echo "**Swift**"
104+
echo '```swift'
105+
echo ".package(url: \"https://github.com/basecamp/basecamp-sdk.git\", from: \"${SEMVER}\")"
106+
echo '```'
107+
echo ""
108+
echo "**Kotlin**"
109+
echo '```kotlin'
110+
echo "implementation(\"com.basecamp:basecamp-sdk:${SEMVER}\")"
111+
echo '```'
112+
} > changelog.md
113+
114+
- name: Fallback changelog
115+
if: steps.summarize.outcome != 'success'
116+
run: |
117+
VERSION="${{ steps.version.outputs.version }}"
118+
SEMVER="${{ steps.version.outputs.semver }}"
119+
{
120+
echo "## Changes"
121+
echo ""
122+
cat /tmp/commits.txt
123+
echo ""
124+
echo "## Installation"
125+
echo ""
126+
echo "**Go**"
127+
echo '```'
128+
echo "go get github.com/basecamp/basecamp-sdk/go@${VERSION}"
129+
echo '```'
130+
echo ""
131+
echo "**TypeScript**"
132+
echo '```'
133+
echo "npm install @37signals/basecamp@${SEMVER}"
134+
echo '```'
135+
echo ""
136+
echo "**Ruby**"
137+
echo '```'
138+
echo "gem install basecamp-sdk -v ${SEMVER}"
139+
echo '```'
140+
echo ""
141+
echo "**Swift**"
142+
echo '```swift'
143+
echo ".package(url: \"https://github.com/basecamp/basecamp-sdk.git\", from: \"${SEMVER}\")"
144+
echo '```'
145+
echo ""
146+
echo "**Kotlin**"
147+
echo '```kotlin'
148+
echo "implementation(\"com.basecamp:basecamp-sdk:${SEMVER}\")"
149+
echo '```'
150+
} > changelog.md
151+
152+
- name: Create GitHub Release
153+
uses: softprops/action-gh-release@v2
154+
with:
155+
name: Basecamp SDK ${{ steps.version.outputs.version }}
156+
body_path: changelog.md
157+
draft: false
158+
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
159+
env:
160+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)