Skip to content

Commit 8193504

Browse files
authored
release: v0.4.0 — CI/CD pipeline + workflow tests (#47)
* feat: add CI, preview validation, and release automation workflows * test: add CI/CD workflow tests (22 new tests) --------- Co-authored-by: bradygaster <bradygaster@users.noreply.github.com>
1 parent c3f715f commit 8193504

7 files changed

Lines changed: 537 additions & 0 deletions

File tree

‎.github/workflows/squad-ci.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Squad CI
2+
3+
on:
4+
pull_request:
5+
branches: [dev, preview, main]
6+
types: [opened, synchronize, reopened]
7+
push:
8+
branches: [dev]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
23+
- name: Run tests
24+
run: node --test test/*.test.js
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Squad Preview Validation
2+
3+
on:
4+
push:
5+
branches: [preview]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
validate:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 22
19+
20+
- name: Run tests
21+
run: node --test test/*.test.js
22+
23+
- name: Check no .ai-team/ files are tracked
24+
run: |
25+
if git ls-files --error-unmatch .ai-team/ 2>/dev/null; then
26+
echo "::error::❌ .ai-team/ files are tracked on preview — this must not ship."
27+
exit 1
28+
fi
29+
echo "✅ No .ai-team/ files tracked — clean for release."
30+
31+
- name: Validate package.json version
32+
run: |
33+
VERSION=$(node -e "console.log(require('./package.json').version)")
34+
if [ -z "$VERSION" ]; then
35+
echo "::error::❌ No version field found in package.json."
36+
exit 1
37+
fi
38+
echo "✅ package.json version: $VERSION"
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Squad Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 22
21+
22+
- name: Run tests
23+
run: node --test test/*.test.js
24+
25+
- name: Read version from package.json
26+
id: version
27+
run: |
28+
VERSION=$(node -e "console.log(require('./package.json').version)")
29+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
30+
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
31+
echo "📦 Version: $VERSION (tag: v$VERSION)"
32+
33+
- name: Check if tag already exists
34+
id: check_tag
35+
run: |
36+
if git rev-parse "refs/tags/${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
37+
echo "exists=true" >> "$GITHUB_OUTPUT"
38+
echo "⏭️ Tag ${{ steps.version.outputs.tag }} already exists — skipping release."
39+
else
40+
echo "exists=false" >> "$GITHUB_OUTPUT"
41+
echo "🆕 Tag ${{ steps.version.outputs.tag }} does not exist — creating release."
42+
fi
43+
44+
- name: Create git tag
45+
if: steps.check_tag.outputs.exists == 'false'
46+
run: |
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
50+
git push origin "${{ steps.version.outputs.tag }}"
51+
52+
- name: Create GitHub Release
53+
if: steps.check_tag.outputs.exists == 'false'
54+
env:
55+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
run: |
57+
gh release create "${{ steps.version.outputs.tag }}" \
58+
--title "${{ steps.version.outputs.tag }}" \
59+
--generate-notes \
60+
--latest
61+
62+
- name: Verify release
63+
if: steps.check_tag.outputs.exists == 'false'
64+
env:
65+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: |
67+
gh release view "${{ steps.version.outputs.tag }}"
68+
echo "✅ Release ${{ steps.version.outputs.tag }} created and verified."

‎templates/workflows/squad-ci.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Squad CI
2+
3+
on:
4+
pull_request:
5+
branches: [dev, preview, main]
6+
types: [opened, synchronize, reopened]
7+
push:
8+
branches: [dev]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
23+
- name: Run tests
24+
run: node --test test/*.test.js
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Squad Preview Validation
2+
3+
on:
4+
push:
5+
branches: [preview]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
validate:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 22
19+
20+
- name: Run tests
21+
run: node --test test/*.test.js
22+
23+
- name: Check no .ai-team/ files are tracked
24+
run: |
25+
if git ls-files --error-unmatch .ai-team/ 2>/dev/null; then
26+
echo "::error::❌ .ai-team/ files are tracked on preview — this must not ship."
27+
exit 1
28+
fi
29+
echo "✅ No .ai-team/ files tracked — clean for release."
30+
31+
- name: Validate package.json version
32+
run: |
33+
VERSION=$(node -e "console.log(require('./package.json').version)")
34+
if [ -z "$VERSION" ]; then
35+
echo "::error::❌ No version field found in package.json."
36+
exit 1
37+
fi
38+
echo "✅ package.json version: $VERSION"
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Squad Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 22
21+
22+
- name: Run tests
23+
run: node --test test/*.test.js
24+
25+
- name: Read version from package.json
26+
id: version
27+
run: |
28+
VERSION=$(node -e "console.log(require('./package.json').version)")
29+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
30+
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
31+
echo "📦 Version: $VERSION (tag: v$VERSION)"
32+
33+
- name: Check if tag already exists
34+
id: check_tag
35+
run: |
36+
if git rev-parse "refs/tags/${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
37+
echo "exists=true" >> "$GITHUB_OUTPUT"
38+
echo "⏭️ Tag ${{ steps.version.outputs.tag }} already exists — skipping release."
39+
else
40+
echo "exists=false" >> "$GITHUB_OUTPUT"
41+
echo "🆕 Tag ${{ steps.version.outputs.tag }} does not exist — creating release."
42+
fi
43+
44+
- name: Create git tag
45+
if: steps.check_tag.outputs.exists == 'false'
46+
run: |
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
50+
git push origin "${{ steps.version.outputs.tag }}"
51+
52+
- name: Create GitHub Release
53+
if: steps.check_tag.outputs.exists == 'false'
54+
env:
55+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
run: |
57+
gh release create "${{ steps.version.outputs.tag }}" \
58+
--title "${{ steps.version.outputs.tag }}" \
59+
--generate-notes \
60+
--latest
61+
62+
- name: Verify release
63+
if: steps.check_tag.outputs.exists == 'false'
64+
env:
65+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: |
67+
gh release view "${{ steps.version.outputs.tag }}"
68+
echo "✅ Release ${{ steps.version.outputs.tag }} created and verified."

0 commit comments

Comments
 (0)