Skip to content

Commit 9f27fc0

Browse files
authored
feat: fix native agent update logic and automate release documentation (#52)
* fix: update native workflow to stop failing * feat: add automated docs PR to release workflow * fix: updated permissions in update-documentation workflow
1 parent ae48acf commit 9f27fc0

File tree

3 files changed

+159
-340
lines changed

3 files changed

+159
-340
lines changed

.github/scripts/generate-docs.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
# --- 1. REQUIRE VERSION ---
4+
if [ -z "$PASSED_VERSION" ]; then
5+
echo "::error::PASSED_VERSION missing"
6+
exit 1
7+
fi
8+
9+
VERSION=$PASSED_VERSION
10+
11+
# --- 2. PARSE CHANGELOG.MD ---
12+
# 1. Finds the header matching '## VERSION'
13+
# 2. Collects everything until it hits the NEXT '## ' followed by a number
14+
# 3. This handles the double-hash format used in your Unity changelog
15+
RELEASE_NOTES=$(awk "/^## ${VERSION}/{flag=1;next} /^## [0-9]/{flag=0} flag" CHANGELOG.md)
16+
17+
# Clean up: Remove empty lines and format bullets
18+
# Ensures lines starting with '-' become '* '
19+
IMPROVEMENTS=$(echo "$RELEASE_NOTES" | grep "^-" | sed 's/^- /* /')
20+
21+
# Fallback if no specific improvements found
22+
if [ -z "$IMPROVEMENTS" ]; then
23+
IMPROVEMENTS="* Updated native agent dependencies."
24+
fi
25+
26+
# --- 3. CREATE THE MDX ---
27+
RELEASE_DATE=$(date +%Y-%m-%d)
28+
# Unity uses GitHub releases as the primary distribution link
29+
FINAL_DOWNLOAD_URL="${REPO_URL}/releases/tag/v${VERSION}"
30+
31+
cat > "release-notes.mdx" << EOF
32+
---
33+
subject: ${AGENT_TITLE}
34+
releaseDate: '${RELEASE_DATE}'
35+
version: ${VERSION}
36+
downloadLink: '${FINAL_DOWNLOAD_URL}'
37+
---
38+
39+
## Improvements
40+
41+
${IMPROVEMENTS}
42+
EOF
43+
44+
# --- 4. EXPORT CONTRACT ---
45+
echo "FINAL_VERSION=$VERSION" > release_info.env
46+
47+
echo "✅ Generated release-notes.mdx for version $VERSION"

0 commit comments

Comments
 (0)