Skip to content

Commit 1a84b4b

Browse files
authored
Merge pull request #406 from github/consolidate-scripts
Update for better maintainability
2 parents 219ad02 + b03bba3 commit 1a84b4b

35 files changed

+1536
-567
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,13 @@ jobs:
2525
- name: Get latest tag
2626
id: get_tag
2727
run: |
28-
# Get the latest tag, or use v0.0.0 if no tags exist
29-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
30-
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
31-
32-
# Extract version number and increment
33-
VERSION=$(echo $LATEST_TAG | sed 's/v//')
34-
IFS='.' read -ra VERSION_PARTS <<< "$VERSION"
35-
MAJOR=${VERSION_PARTS[0]:-0}
36-
MINOR=${VERSION_PARTS[1]:-0}
37-
PATCH=${VERSION_PARTS[2]:-0}
38-
39-
# Increment patch version
40-
PATCH=$((PATCH + 1))
41-
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
42-
43-
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
44-
echo "New version will be: $NEW_VERSION"
28+
chmod +x .github/workflows/scripts/get-next-version.sh
29+
.github/workflows/scripts/get-next-version.sh
4530
- name: Check if release already exists
4631
id: check_release
4732
run: |
48-
if gh release view ${{ steps.get_tag.outputs.new_version }} >/dev/null 2>&1; then
49-
echo "exists=true" >> $GITHUB_OUTPUT
50-
echo "Release ${{ steps.get_tag.outputs.new_version }} already exists, skipping..."
51-
else
52-
echo "exists=false" >> $GITHUB_OUTPUT
53-
echo "Release ${{ steps.get_tag.outputs.new_version }} does not exist, proceeding..."
54-
fi
33+
chmod +x .github/workflows/scripts/check-release-exists.sh
34+
.github/workflows/scripts/check-release-exists.sh ${{ steps.get_tag.outputs.new_version }}
5535
env:
5636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5737
- name: Create release package variants
@@ -63,85 +43,17 @@ jobs:
6343
if: steps.check_release.outputs.exists == 'false'
6444
id: release_notes
6545
run: |
66-
# Get commits since last tag
67-
LAST_TAG=${{ steps.get_tag.outputs.latest_tag }}
68-
if [ "$LAST_TAG" = "v0.0.0" ]; then
69-
# Check how many commits we have and use that as the limit
70-
COMMIT_COUNT=$(git rev-list --count HEAD)
71-
if [ "$COMMIT_COUNT" -gt 10 ]; then
72-
COMMITS=$(git log --oneline --pretty=format:"- %s" HEAD~10..HEAD)
73-
else
74-
COMMITS=$(git log --oneline --pretty=format:"- %s" HEAD~$COMMIT_COUNT..HEAD 2>/dev/null || git log --oneline --pretty=format:"- %s")
75-
fi
76-
else
77-
COMMITS=$(git log --oneline --pretty=format:"- %s" $LAST_TAG..HEAD)
78-
fi
79-
80-
# Create release notes
81-
cat > release_notes.md << EOF
82-
Template release ${{ steps.get_tag.outputs.new_version }}
83-
84-
Updated specification-driven development templates for GitHub Copilot, Claude Code, Gemini CLI, Cursor, Qwen, opencode, Windsurf, and Codex.
85-
86-
Now includes per-script variants for POSIX shell (sh) and PowerShell (ps).
87-
88-
Download the template for your preferred AI assistant + script type:
89-
- spec-kit-template-copilot-sh-${{ steps.get_tag.outputs.new_version }}.zip
90-
- spec-kit-template-copilot-ps-${{ steps.get_tag.outputs.new_version }}.zip
91-
- spec-kit-template-claude-sh-${{ steps.get_tag.outputs.new_version }}.zip
92-
- spec-kit-template-claude-ps-${{ steps.get_tag.outputs.new_version }}.zip
93-
- spec-kit-template-gemini-sh-${{ steps.get_tag.outputs.new_version }}.zip
94-
- spec-kit-template-gemini-ps-${{ steps.get_tag.outputs.new_version }}.zip
95-
- spec-kit-template-cursor-sh-${{ steps.get_tag.outputs.new_version }}.zip
96-
- spec-kit-template-cursor-ps-${{ steps.get_tag.outputs.new_version }}.zip
97-
- spec-kit-template-opencode-sh-${{ steps.get_tag.outputs.new_version }}.zip
98-
- spec-kit-template-opencode-ps-${{ steps.get_tag.outputs.new_version }}.zip
99-
- spec-kit-template-qwen-sh-${{ steps.get_tag.outputs.new_version }}.zip
100-
- spec-kit-template-qwen-ps-${{ steps.get_tag.outputs.new_version }}.zip
101-
- spec-kit-template-windsurf-sh-${{ steps.get_tag.outputs.new_version }}.zip
102-
- spec-kit-template-windsurf-ps-${{ steps.get_tag.outputs.new_version }}.zip
103-
- spec-kit-template-codex-sh-${{ steps.get_tag.outputs.new_version }}.zip
104-
- spec-kit-template-codex-ps-${{ steps.get_tag.outputs.new_version }}.zip
105-
EOF
106-
107-
echo "Generated release notes:"
108-
cat release_notes.md
46+
chmod +x .github/workflows/scripts/generate-release-notes.sh
47+
.github/workflows/scripts/generate-release-notes.sh ${{ steps.get_tag.outputs.new_version }} ${{ steps.get_tag.outputs.latest_tag }}
10948
- name: Create GitHub Release
11049
if: steps.check_release.outputs.exists == 'false'
11150
run: |
112-
# Remove 'v' prefix from version for release title
113-
VERSION_NO_V=${{ steps.get_tag.outputs.new_version }}
114-
VERSION_NO_V=${VERSION_NO_V#v}
115-
116-
gh release create ${{ steps.get_tag.outputs.new_version }} \
117-
spec-kit-template-copilot-sh-${{ steps.get_tag.outputs.new_version }}.zip \
118-
spec-kit-template-copilot-ps-${{ steps.get_tag.outputs.new_version }}.zip \
119-
spec-kit-template-claude-sh-${{ steps.get_tag.outputs.new_version }}.zip \
120-
spec-kit-template-claude-ps-${{ steps.get_tag.outputs.new_version }}.zip \
121-
spec-kit-template-gemini-sh-${{ steps.get_tag.outputs.new_version }}.zip \
122-
spec-kit-template-gemini-ps-${{ steps.get_tag.outputs.new_version }}.zip \
123-
spec-kit-template-cursor-sh-${{ steps.get_tag.outputs.new_version }}.zip \
124-
spec-kit-template-cursor-ps-${{ steps.get_tag.outputs.new_version }}.zip \
125-
spec-kit-template-opencode-sh-${{ steps.get_tag.outputs.new_version }}.zip \
126-
spec-kit-template-opencode-ps-${{ steps.get_tag.outputs.new_version }}.zip \
127-
spec-kit-template-qwen-sh-${{ steps.get_tag.outputs.new_version }}.zip \
128-
spec-kit-template-qwen-ps-${{ steps.get_tag.outputs.new_version }}.zip \
129-
spec-kit-template-windsurf-sh-${{ steps.get_tag.outputs.new_version }}.zip \
130-
spec-kit-template-windsurf-ps-${{ steps.get_tag.outputs.new_version }}.zip \
131-
spec-kit-template-codex-sh-${{ steps.get_tag.outputs.new_version }}.zip \
132-
spec-kit-template-codex-ps-${{ steps.get_tag.outputs.new_version }}.zip \
133-
--title "Spec Kit Templates - $VERSION_NO_V" \
134-
--notes-file release_notes.md
51+
chmod +x .github/workflows/scripts/create-github-release.sh
52+
.github/workflows/scripts/create-github-release.sh ${{ steps.get_tag.outputs.new_version }}
13553
env:
13654
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13755
- name: Update version in pyproject.toml (for release artifacts only)
13856
if: steps.check_release.outputs.exists == 'false'
13957
run: |
140-
# Update version in pyproject.toml (remove 'v' prefix for Python versioning)
141-
VERSION=${{ steps.get_tag.outputs.new_version }}
142-
PYTHON_VERSION=${VERSION#v}
143-
144-
if [ -f "pyproject.toml" ]; then
145-
sed -i "s/version = \".*\"/version = \"$PYTHON_VERSION\"/" pyproject.toml
146-
echo "Updated pyproject.toml version to $PYTHON_VERSION (for release artifacts only)"
147-
fi
58+
chmod +x .github/workflows/scripts/update-version.sh
59+
.github/workflows/scripts/update-version.sh ${{ steps.get_tag.outputs.new_version }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# check-release-exists.sh
5+
# Check if a GitHub release already exists for the given version
6+
# Usage: check-release-exists.sh <version>
7+
8+
if [[ $# -ne 1 ]]; then
9+
echo "Usage: $0 <version>" >&2
10+
exit 1
11+
fi
12+
13+
VERSION="$1"
14+
15+
if gh release view "$VERSION" >/dev/null 2>&1; then
16+
echo "exists=true" >> $GITHUB_OUTPUT
17+
echo "Release $VERSION already exists, skipping..."
18+
else
19+
echo "exists=false" >> $GITHUB_OUTPUT
20+
echo "Release $VERSION does not exist, proceeding..."
21+
fi
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# create-github-release.sh
5+
# Create a GitHub release with all template zip files
6+
# Usage: create-github-release.sh <version>
7+
8+
if [[ $# -ne 1 ]]; then
9+
echo "Usage: $0 <version>" >&2
10+
exit 1
11+
fi
12+
13+
VERSION="$1"
14+
15+
# Remove 'v' prefix from version for release title
16+
VERSION_NO_V=${VERSION#v}
17+
18+
gh release create "$VERSION" \
19+
.genreleases/spec-kit-template-copilot-sh-"$VERSION".zip \
20+
.genreleases/spec-kit-template-copilot-ps-"$VERSION".zip \
21+
.genreleases/spec-kit-template-claude-sh-"$VERSION".zip \
22+
.genreleases/spec-kit-template-claude-ps-"$VERSION".zip \
23+
.genreleases/spec-kit-template-gemini-sh-"$VERSION".zip \
24+
.genreleases/spec-kit-template-gemini-ps-"$VERSION".zip \
25+
.genreleases/spec-kit-template-cursor-sh-"$VERSION".zip \
26+
.genreleases/spec-kit-template-cursor-ps-"$VERSION".zip \
27+
.genreleases/spec-kit-template-opencode-sh-"$VERSION".zip \
28+
.genreleases/spec-kit-template-opencode-ps-"$VERSION".zip \
29+
.genreleases/spec-kit-template-qwen-sh-"$VERSION".zip \
30+
.genreleases/spec-kit-template-qwen-ps-"$VERSION".zip \
31+
.genreleases/spec-kit-template-windsurf-sh-"$VERSION".zip \
32+
.genreleases/spec-kit-template-windsurf-ps-"$VERSION".zip \
33+
.genreleases/spec-kit-template-codex-sh-"$VERSION".zip \
34+
.genreleases/spec-kit-template-codex-ps-"$VERSION".zip \
35+
--title "Spec Kit Templates - $VERSION_NO_V" \
36+
--notes-file release_notes.md

.github/workflows/scripts/create-release-packages.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ fi
2525

2626
echo "Building release packages for $NEW_VERSION"
2727

28-
rm -rf sdd-package-base* sdd-*-package-* spec-kit-template-*-"${NEW_VERSION}".zip || true
28+
# Create and use .genreleases directory for all build artifacts
29+
GENRELEASES_DIR=".genreleases"
30+
mkdir -p "$GENRELEASES_DIR"
31+
rm -rf "$GENRELEASES_DIR"/* || true
2932

3033
rewrite_paths() {
3134
sed -E \
@@ -82,7 +85,7 @@ generate_commands() {
8285

8386
build_variant() {
8487
local agent=$1 script=$2
85-
local base_dir="sdd-${agent}-package-${script}"
88+
local base_dir="$GENRELEASES_DIR/sdd-${agent}-package-${script}"
8689
echo "Building $agent ($script) package..."
8790
mkdir -p "$base_dir"
8891

@@ -158,11 +161,11 @@ build_variant() {
158161
mkdir -p "$base_dir/.windsurf/workflows"
159162
generate_commands windsurf md "\$ARGUMENTS" "$base_dir/.windsurf/workflows" "$script" ;;
160163
codex)
161-
mkdir -p "$base_dir/.codex/commands"
162-
generate_commands codex md "\$ARGUMENTS" "$base_dir/.codex/commands" "$script" ;;
164+
mkdir -p "$base_dir/.codex/prompts"
165+
generate_commands codex md "\$ARGUMENTS" "$base_dir/.codex/prompts" "$script" ;;
163166
esac
164167
( cd "$base_dir" && zip -r "../spec-kit-template-${agent}-${script}-${NEW_VERSION}.zip" . )
165-
echo "Created spec-kit-template-${agent}-${script}-${NEW_VERSION}.zip"
168+
echo "Created $GENRELEASES_DIR/spec-kit-template-${agent}-${script}-${NEW_VERSION}.zip"
166169
}
167170

168171
# Determine agent list
@@ -212,5 +215,5 @@ for agent in "${AGENT_LIST[@]}"; do
212215
done
213216
done
214217

215-
echo "Archives:"
216-
ls -1 spec-kit-template-*-"${NEW_VERSION}".zip
218+
echo "Archives in $GENRELEASES_DIR:"
219+
ls -1 "$GENRELEASES_DIR"/spec-kit-template-*-"${NEW_VERSION}".zip
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# generate-release-notes.sh
5+
# Generate release notes from git history
6+
# Usage: generate-release-notes.sh <new_version> <last_tag>
7+
8+
if [[ $# -ne 2 ]]; then
9+
echo "Usage: $0 <new_version> <last_tag>" >&2
10+
exit 1
11+
fi
12+
13+
NEW_VERSION="$1"
14+
LAST_TAG="$2"
15+
16+
# Get commits since last tag
17+
if [ "$LAST_TAG" = "v0.0.0" ]; then
18+
# Check how many commits we have and use that as the limit
19+
COMMIT_COUNT=$(git rev-list --count HEAD)
20+
if [ "$COMMIT_COUNT" -gt 10 ]; then
21+
COMMITS=$(git log --oneline --pretty=format:"- %s" HEAD~10..HEAD)
22+
else
23+
COMMITS=$(git log --oneline --pretty=format:"- %s" HEAD~$COMMIT_COUNT..HEAD 2>/dev/null || git log --oneline --pretty=format:"- %s")
24+
fi
25+
else
26+
COMMITS=$(git log --oneline --pretty=format:"- %s" $LAST_TAG..HEAD)
27+
fi
28+
29+
# Create release notes
30+
cat > release_notes.md << EOF
31+
Template release $NEW_VERSION
32+
33+
Updated specification-driven development templates for GitHub Copilot, Claude Code, Gemini CLI, Cursor, Qwen, opencode, Windsurf, and Codex.
34+
35+
Now includes per-script variants for POSIX shell (sh) and PowerShell (ps).
36+
37+
Download the template for your preferred AI assistant + script type:
38+
- spec-kit-template-copilot-sh-$NEW_VERSION.zip
39+
- spec-kit-template-copilot-ps-$NEW_VERSION.zip
40+
- spec-kit-template-claude-sh-$NEW_VERSION.zip
41+
- spec-kit-template-claude-ps-$NEW_VERSION.zip
42+
- spec-kit-template-gemini-sh-$NEW_VERSION.zip
43+
- spec-kit-template-gemini-ps-$NEW_VERSION.zip
44+
- spec-kit-template-cursor-sh-$NEW_VERSION.zip
45+
- spec-kit-template-cursor-ps-$NEW_VERSION.zip
46+
- spec-kit-template-opencode-sh-$NEW_VERSION.zip
47+
- spec-kit-template-opencode-ps-$NEW_VERSION.zip
48+
- spec-kit-template-qwen-sh-$NEW_VERSION.zip
49+
- spec-kit-template-qwen-ps-$NEW_VERSION.zip
50+
- spec-kit-template-windsurf-sh-$NEW_VERSION.zip
51+
- spec-kit-template-windsurf-ps-$NEW_VERSION.zip
52+
- spec-kit-template-codex-sh-$NEW_VERSION.zip
53+
- spec-kit-template-codex-ps-$NEW_VERSION.zip
54+
EOF
55+
56+
echo "Generated release notes:"
57+
cat release_notes.md
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# get-next-version.sh
5+
# Calculate the next version based on the latest git tag and output GitHub Actions variables
6+
# Usage: get-next-version.sh
7+
8+
# Get the latest tag, or use v0.0.0 if no tags exist
9+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
10+
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
11+
12+
# Extract version number and increment
13+
VERSION=$(echo $LATEST_TAG | sed 's/v//')
14+
IFS='.' read -ra VERSION_PARTS <<< "$VERSION"
15+
MAJOR=${VERSION_PARTS[0]:-0}
16+
MINOR=${VERSION_PARTS[1]:-0}
17+
PATCH=${VERSION_PARTS[2]:-0}
18+
19+
# Increment patch version
20+
PATCH=$((PATCH + 1))
21+
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
22+
23+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
24+
echo "New version will be: $NEW_VERSION"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# update-version.sh
5+
# Update version in pyproject.toml (for release artifacts only)
6+
# Usage: update-version.sh <version>
7+
8+
if [[ $# -ne 1 ]]; then
9+
echo "Usage: $0 <version>" >&2
10+
exit 1
11+
fi
12+
13+
VERSION="$1"
14+
15+
# Remove 'v' prefix for Python versioning
16+
PYTHON_VERSION=${VERSION#v}
17+
18+
if [ -f "pyproject.toml" ]; then
19+
sed -i "s/version = \".*\"/version = \"$PYTHON_VERSION\"/" pyproject.toml
20+
echo "Updated pyproject.toml version to $PYTHON_VERSION (for release artifacts only)"
21+
else
22+
echo "Warning: pyproject.toml not found, skipping version update"
23+
fi

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ env/
3838
.env
3939
.env.local
4040
*.lock
41+
42+
# Spec Kit-specific files
43+
.genreleases/
44+
*.zip
45+
sdd-*/

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to the Specify CLI will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.0.12] - 2025-09-21
9+
10+
### Changed
11+
12+
- Added additional context for OpenAI Codex users - they need to set an additional environment variable, as described in [#417](https://github.com/github/spec-kit/issues/417).
13+
814
## [0.0.11] - 2025-09-20
915

1016
### Added

0 commit comments

Comments
 (0)