Skip to content

Commit 742631d

Browse files
author
CI/CD Tester
committed
feat: Implement automated GitHub release and issue management workflow
1 parent 22854bb commit 742631d

File tree

7 files changed

+185
-1178
lines changed

7 files changed

+185
-1178
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,24 @@
1-
name: Continuous Integration
1+
name: CI
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [ main ]
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
pull-requests: write
814

915
jobs:
10-
test:
16+
build:
1117
runs-on: ubuntu-latest
12-
13-
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
16-
17-
- name: Setup dependencies
18-
run: |
19-
sudo apt-get update
20-
sudo apt-get install -y jq shellcheck
21-
22-
- name: Install GitHub CLI
23-
run: |
24-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
25-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
26-
sudo apt update
27-
sudo apt install gh
28-
29-
- name: Shellcheck validation
30-
run: |
31-
echo "Running shellcheck on shell scripts..."
32-
shellcheck gh-issue-manager.sh || echo "⚠️ Shellcheck warnings in gh-issue-manager.sh"
33-
shellcheck gh-release-manager.sh || echo "⚠️ Shellcheck warnings in gh-release-manager.sh"
34-
find tests -name "*.sh" -exec shellcheck {} \; || echo "⚠️ Shellcheck warnings in test files"
35-
36-
- name: Run unit tests
37-
run: |
38-
chmod +x tests/test-unit.sh
39-
./tests/test-unit.sh || echo "⚠️ Some unit tests failed"
40-
41-
- name: Run release manager tests
42-
run: |
43-
chmod +x tests/test-release-manager.sh
44-
./tests/test-release-manager.sh
45-
46-
- name: Test dry-run release
47-
run: |
48-
chmod +x gh-release-manager.sh
49-
./gh-release-manager.sh -d
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5218

53-
security:
54-
runs-on: ubuntu-latest
55-
5619
steps:
57-
- name: Checkout code
58-
uses: actions/checkout@v4
59-
60-
- name: Security scan
61-
run: |
62-
echo "Running security checks..."
63-
# Check for hardcoded secrets
64-
grep -r "ghp_\|github_pat_" . --exclude-dir=.git || echo "✅ No hardcoded GitHub tokens found"
65-
66-
# Check for suspicious patterns
67-
grep -r "eval\|exec\|system" *.sh tests/*.sh || echo "✅ No suspicious command execution patterns found"
68-
69-
# Check file permissions
70-
find . -name "*.sh" -perm /111 | while read file; do
71-
echo "Executable script: $file"
72-
done
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Run all tests
24+
run: ./tests/run-all-tests.sh

.github/workflows/release.yml

Lines changed: 141 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,158 @@
1-
name: Automated Release
1+
name: Release
22

33
on:
44
workflow_dispatch:
55
inputs:
6-
version_bump:
7-
description: 'Version bump type'
6+
version-bump:
7+
description: 'Version bump type (major, minor, or patch)'
88
required: true
99
default: 'patch'
1010
type: choice
1111
options:
1212
- patch
1313
- minor
1414
- major
15-
pre_release:
16-
description: 'Create pre-release'
17-
required: false
18-
default: false
19-
type: boolean
20-
pre_release_tag:
21-
description: 'Pre-release tag (e.g., alpha.1, beta.2)'
22-
required: false
23-
type: string
15+
16+
permissions:
17+
contents: write
18+
issues: write
2419

2520
jobs:
21+
test:
22+
name: Run Tests
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Run all tests
29+
run: ./tests/run-all-tests.sh
30+
2631
release:
32+
name: Create Release
33+
needs: test
2734
runs-on: ubuntu-latest
28-
permissions:
29-
contents: write
30-
issues: write
31-
pull-requests: write
32-
3335
steps:
34-
- name: Checkout code
35-
uses: actions/checkout@v4
36-
with:
37-
fetch-depth: 0
38-
token: ${{ secrets.GITHUB_TOKEN }}
39-
40-
- name: Setup dependencies
41-
run: |
42-
sudo apt-get update
43-
sudo apt-get install -y jq
44-
45-
- name: Verify GitHub CLI
46-
run: |
47-
gh --version
48-
gh auth status
49-
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
52-
- name: Run comprehensive tests
53-
run: |
54-
chmod +x tests/run-all-tests.sh
55-
./tests/run-all-tests.sh
56-
57-
- name: Create release (patch)
58-
if: ${{ inputs.version_bump == 'patch' && !inputs.pre_release }}
59-
run: |
60-
chmod +x gh-release-manager.sh
61-
./gh-release-manager.sh -p
62-
env:
63-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64-
65-
- name: Create release (minor)
66-
if: ${{ inputs.version_bump == 'minor' && !inputs.pre_release }}
67-
run: |
68-
chmod +x gh-release-manager.sh
69-
./gh-release-manager.sh -m
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
73-
- name: Create release (major)
74-
if: ${{ inputs.version_bump == 'major' && !inputs.pre_release }}
75-
run: |
76-
chmod +x gh-release-manager.sh
77-
./gh-release-manager.sh -M
78-
env:
79-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80-
81-
- name: Create pre-release (alpha)
82-
if: ${{ inputs.pre_release && contains(inputs.pre_release_tag, 'alpha') }}
83-
run: |
84-
chmod +x gh-release-manager.sh
85-
./gh-release-manager.sh -a ${{ inputs.pre_release_tag }}
86-
env:
87-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
89-
- name: Create pre-release (beta)
90-
if: ${{ inputs.pre_release && contains(inputs.pre_release_tag, 'beta') }}
91-
run: |
92-
chmod +x gh-release-manager.sh
93-
./gh-release-manager.sh -b ${{ inputs.pre_release_tag }}
94-
env:
95-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96-
97-
- name: Close fixed issues
98-
run: |
99-
# Get issues marked as fixed-in-next-release
100-
gh issue list --label "fixed-in-next-release" --state open --json number,title | \
101-
jq -r '.[] | .number' | \
102-
while read issue_number; do
103-
if [ -n "$issue_number" ]; then
104-
echo "Closing issue #$issue_number"
105-
gh issue close "$issue_number" --comment "Fixed in latest release"
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0 # Required for git-cliff
40+
41+
- name: Set up Git
42+
run: |
43+
git config user.name "github-actions[bot]"
44+
git config user.email "github-actions[bot]@users.noreply.github.com"
45+
46+
- name: Determine next version
47+
id: version
48+
run: |
49+
# Get the latest tag
50+
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
51+
latest_version=${latest_tag#v}
52+
53+
# Split version into components
54+
IFS='.' read -r -a version_parts <<< "$latest_version"
55+
major=${version_parts[0]}
56+
minor=${version_parts[1]}
57+
patch=${version_parts[2]}
58+
59+
# Bump version based on input
60+
case "${{ github.event.inputs.version-bump }}" in
61+
major)
62+
major=$((major + 1))
63+
minor=0
64+
patch=0
65+
;;
66+
minor)
67+
minor=$((minor + 1))
68+
patch=0
69+
;;
70+
patch)
71+
patch=$((patch + 1))
72+
;;
73+
esac
74+
75+
new_version="v$major.$minor.$patch"
76+
echo "new_version=$new_version" >> $GITHUB_OUTPUT
77+
78+
- name: Generate release notes
79+
id: release_notes
80+
uses: orhun/git-cliff-action@v2
81+
with:
82+
config: |
83+
[changelog]
84+
header = """
85+
# Changelog
86+
"""
87+
body = """
88+
{% if version %}
89+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
90+
{% else %}
91+
## [unreleased]
92+
{% endif %}
93+
{% for group, commits in commits | group_by(attribute="group") %}
94+
### {{ group | upper_first }}
95+
{% for commit in commits %}
96+
- {{ commit.message | upper_first }} ([`{{ commit.id | truncate(length=7, end="") }}`](https://github.com/${{ github.repository }}/commit/{{ commit.id }}))
97+
{% endfor %}
98+
{% endfor %}
99+
"""
100+
footer = ""
101+
tag: ${{ steps.version.outputs.new_version }}
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
105+
- name: Update CHANGELOG.md
106+
run: |
107+
echo "${{ steps.release_notes.outputs.content }}" > CHANGELOG.md
108+
109+
- name: Commit and push CHANGELOG.md
110+
run: |
111+
git add CHANGELOG.md
112+
git commit -m "docs: update CHANGELOG.md for ${{ steps.version.outputs.new_version }}"
113+
git push
114+
115+
- name: Create GitHub Release
116+
uses: ncipollo/release-action@v1
117+
with:
118+
tag: ${{ steps.version.outputs.new_version }}
119+
name: ${{ steps.version.outputs.new_version }}
120+
body: ${{ steps.release_notes.outputs.content }}
121+
token: ${{ secrets.GITHUB_TOKEN }}
122+
123+
- name: Process and close issues
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
RELEASE_NOTES: ${{ steps.release_notes.outputs.content }}
127+
RELEASE_VERSION: ${{ steps.version.outputs.new_version }}
128+
run: |
129+
#!/bin/bash
130+
set -euo pipefail
131+
132+
# Extract issue numbers from release notes
133+
issue_numbers=$(echo "$RELEASE_NOTES" | grep -oP '#\d+' | sed 's/#//' | sort -u)
134+
135+
if [ -z "$issue_numbers" ]; then
136+
echo "No issues found in release notes."
137+
exit 0
106138
fi
107-
done
108-
env:
109-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110-
111-
- name: Update project boards
112-
run: |
113-
# Update any linked project boards
114-
echo "Updating project boards with release information..."
115-
# This can be extended based on specific project board requirements
116-
env:
117-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
140+
echo "Found issues: $issue_numbers"
141+
142+
for issue_number in $issue_numbers; do
143+
echo "Processing issue #$issue_number"
144+
145+
# Check if issue is open
146+
issue_state=$(gh issue view "$issue_number" --json state -q .state)
147+
if [ "$issue_state" != "OPEN" ]; then
148+
echo "Issue #$issue_number is not open, skipping."
149+
continue
150+
fi
151+
152+
# Add label, comment and close issue
153+
gh issue edit "$issue_number" --add-label "released"
154+
gh issue comment "$issue_number" --body "🎉 This issue has been released in version $RELEASE_VERSION."
155+
gh issue close "$issue_number"
156+
157+
echo "Processed issue #$issue_number"
158+
done

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ test-subissues-*
44
logs/
55
GEMINI.md
66
SYSTEM.md
7+
.rovodev/

CHANGELOG.md

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,6 @@
11
# Changelog
22

3-
## v0.1.2 (2025-07-29)
4-
- No significant changes.
5-
6-
## v0.1.1 (2025-07-29)
7-
- No significant changes.
8-
9-
## v0.1.1 (2025-07-29)
10-
- No significant changes.
11-
123
All notable changes to this project will be documented in this file.
134

145
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
156
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
16-
17-
## [Unreleased]
18-
19-
## [v0.1.1] - 2025-01-28
20-
21-
### Added
22-
- GitHub Release Manager script (`gh-release-manager.sh`)
23-
- Automated version management with semver support
24-
- Changelog generation from closed issues
25-
- Integration with existing issue management system
26-
- Comprehensive test suite for release management
27-
- Enhanced logging system with configurable levels
28-
- Dry-run mode for testing release operations
29-
30-
### Changed
31-
- Enhanced project structure with release management capabilities
32-
- Improved test coverage and error handling
33-
- Updated documentation with release management features
34-
35-
### Fixed
36-
- Syntax errors in test files
37-
- Pre-release tag handling in version management
38-
- Shellcheck warnings and POSIX compliance issues

0 commit comments

Comments
 (0)