Skip to content

Commit 746c473

Browse files
✨ Create required scripts file and other workflow files
1 parent c6bdf73 commit 746c473

16 files changed

+2099
-503
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#!/bin/bash
2+
# .github/scripts/release/advanced-release.sh
3+
# Advanced release operations (can be run separately)
4+
5+
set -e
6+
7+
# Function to validate action.yml
8+
validate_action_yml() {
9+
echo "🔍 Validating action.yml..."
10+
11+
if [[ ! -f "action.yml" ]]; then
12+
echo "❌ action.yml not found!"
13+
exit 1
14+
fi
15+
16+
# Basic validation using grep (no external dependencies)
17+
if ! grep -q "^name:" action.yml; then
18+
echo "❌ action.yml missing 'name' field"
19+
exit 1
20+
fi
21+
22+
if ! grep -q "^description:" action.yml; then
23+
echo "❌ action.yml missing 'description' field"
24+
exit 1
25+
fi
26+
27+
echo "✅ action.yml validation passed"
28+
}
29+
30+
# Function to run security scan
31+
security_scan() {
32+
echo "🔒 Running security scan..."
33+
34+
# Run Trivy if available
35+
if command -v trivy &> /dev/null; then
36+
trivy image --exit-code 1 --severity CRITICAL,HIGH test-action:latest
37+
else
38+
echo "⚠️ Trivy not installed, skipping security scan"
39+
fi
40+
}
41+
42+
# Function to update version badges
43+
update_badges() {
44+
local version=$1
45+
echo "📛 Updating version badges..."
46+
47+
# Update README.md badges
48+
if [[ -f "README.md" ]]; then
49+
sed -i "s/badge\/version-v[0-9.]*-blue/badge\/version-v${version}-blue/g" README.md
50+
sed -i "s/badge\/release-v[0-9.]*/badge\/release-v${version}/g" README.md
51+
fi
52+
}
53+
54+
# Function to create release announcement
55+
create_announcement() {
56+
local version=$1
57+
local type=$2
58+
59+
cat > RELEASE_ANNOUNCEMENT.md << EOF
60+
# 🎉 EKS Helm Client v${version} Released!
61+
62+
We're excited to announce the release of EKS Helm Client GitHub Action v${version}.
63+
64+
## Highlights
65+
66+
$(if [[ "$type" == "stable" ]]; then
67+
echo "This is a **stable release** ready for production use."
68+
else
69+
echo "This is a **release candidate** for testing and feedback."
70+
fi)
71+
72+
## Installation
73+
74+
\`\`\`yaml
75+
- uses: open-source-srilanka/eks-helm-client-github-action@v${version}
76+
\`\`\`
77+
78+
## What's New
79+
80+
See the [full changelog](https://github.com/open-source-srilanka/eks-helm-client-github-action/releases/tag/v${version}).
81+
82+
## Support
83+
84+
- 📧 Email: dinushchathurya21@gmail.com
85+
- 🐛 Issues: [GitHub Issues](https://github.com/open-source-srilanka/eks-helm-client-github-action/issues)
86+
- 💬 Discussions: [GitHub Discussions](https://github.com/open-source-srilanka/eks-helm-client-github-action/discussions)
87+
EOF
88+
}
89+
90+
# Main execution based on command
91+
case "${1:-help}" in
92+
validate)
93+
validate_action_yml
94+
;;
95+
security)
96+
security_scan
97+
;;
98+
badges)
99+
update_badges "$2"
100+
;;
101+
announce)
102+
create_announcement "$2" "$3"
103+
;;
104+
all)
105+
validate_action_yml
106+
security_scan
107+
update_badges "$2"
108+
create_announcement "$2" "$3"
109+
;;
110+
help|*)
111+
echo "Usage: $0 [command] [args]"
112+
echo "Commands:"
113+
echo " validate - Validate action.yml"
114+
echo " security - Run security scan"
115+
echo " badges <version> - Update version badges"
116+
echo " announce <ver> <type> - Create release announcement"
117+
echo " all <version> <type> - Run all operations"
118+
;;
119+
esac
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# .github/scripts/release/build-and-test.sh
3+
# Build and test the action before release
4+
5+
set -e
6+
7+
echo "🔨 Building Docker image..."
8+
docker build -t test-action:${{ steps.setup.outputs.version }} .
9+
10+
echo "🧪 Running basic tests..."
11+
# Quick validation test
12+
docker run --rm \
13+
-e INPUT_CLUSTER_NAME=test-cluster \
14+
-e INPUT_REGION=us-west-2 \
15+
-e INPUT_ARGS="echo 'Test successful'" \
16+
-e INPUT_DRY_RUN=true \
17+
-e INPUT_DEBUG=true \
18+
test-action:${{ steps.setup.outputs.version }}
19+
20+
echo "✅ Build and test completed successfully"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# .github/scripts/release/create-tag.sh
3+
# Create git tags for the release
4+
5+
set -e
6+
7+
VERSION="${{ steps.setup.outputs.version }}"
8+
RELEASE_TYPE="${{ steps.setup.outputs.release_type }}"
9+
10+
# Create version tag if it doesn't exist
11+
if ! git rev-parse "v$VERSION" >/dev/null 2>&1; then
12+
git tag "v$VERSION"
13+
git push origin "v$VERSION"
14+
fi
15+
16+
# Update major version tag for stable releases
17+
if [[ "$RELEASE_TYPE" == "stable" ]]; then
18+
MAJOR_VERSION=$(echo $VERSION | cut -d. -f1)
19+
git tag -f "v$MAJOR_VERSION"
20+
git push -f origin "v$MAJOR_VERSION"
21+
echo "✅ Updated major version tag: v$MAJOR_VERSION"
22+
fi
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
# .github/scripts/release/generate-changelog.sh
3+
# Generate changelog for the release
4+
5+
set -e
6+
7+
VERSION="${{ steps.setup.outputs.version }}"
8+
RELEASE_TYPE="${{ steps.setup.outputs.release_type }}"
9+
10+
# Get last tag
11+
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
12+
13+
# Generate changelog
14+
{
15+
echo "## EKS Helm Client v$VERSION"
16+
echo ""
17+
18+
if [[ "$RELEASE_TYPE" == "rc" ]]; then
19+
echo "### ⚠️ Release Candidate"
20+
echo ""
21+
echo "This is a release candidate for testing. Not recommended for production use."
22+
echo ""
23+
fi
24+
25+
echo "### 📋 Changes"
26+
echo ""
27+
28+
if [[ -n "$LAST_TAG" ]]; then
29+
git log $LAST_TAG..HEAD --pretty=format:"- %s (%h)" --no-merges
30+
else
31+
echo "- Initial release"
32+
fi
33+
34+
echo ""
35+
echo ""
36+
echo "### 🚀 Usage"
37+
echo ""
38+
echo '```yaml'
39+
echo "- name: Deploy to EKS"
40+
echo " uses: ${{ github.repository }}@v$VERSION"
41+
echo " with:"
42+
echo " cluster-name: my-cluster"
43+
echo " region: us-west-2"
44+
echo " args: |"
45+
echo " helm upgrade --install my-app ./chart"
46+
echo '```'
47+
echo ""
48+
echo "### 📚 Documentation"
49+
echo ""
50+
echo "- [README](https://github.com/${{ github.repository }}/blob/v$VERSION/README.md)"
51+
echo "- [Migration Guide](https://github.com/${{ github.repository }}/blob/v$VERSION/docs/MIGRATION.md)"
52+
echo "- [Examples](https://github.com/${{ github.repository }}/tree/v$VERSION/docs/examples)"
53+
echo ""
54+
echo "---"
55+
echo ""
56+
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$LAST_TAG...v$VERSION"
57+
} > changelog.md
58+
59+
# Set output
60+
echo 'changelog<<EOF' >> $GITHUB_OUTPUT
61+
cat changelog.md >> $GITHUB_OUTPUT
62+
echo 'EOF' >> $GITHUB_OUTPUT
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
# .github/scripts/release/marketplace-notice.sh
3+
# Display marketplace publication notice
4+
5+
set -e
6+
7+
VERSION="${{ steps.setup.outputs.version }}"
8+
RELEASE_TYPE="${{ steps.setup.outputs.release_type }}"
9+
TAG_NAME="${{ steps.setup.outputs.tag_name }}"
10+
11+
echo "🎉 Release v$VERSION created!"
12+
echo ""
13+
echo "📦 Release Type: $RELEASE_TYPE"
14+
echo "🏷️ Tag: $TAG_NAME"
15+
echo "🔗 Release URL: ${{ github.server_url }}/${{ github.repository }}/releases/tag/$TAG_NAME"
16+
echo ""
17+
18+
if [[ "$RELEASE_TYPE" == "stable" ]]; then
19+
MAJOR_VERSION=$(echo $VERSION | cut -d. -f1)
20+
echo "✅ This stable release will be published to GitHub Marketplace as LATEST"
21+
echo "👥 Users can reference: @v$VERSION or @v$MAJOR_VERSION"
22+
else
23+
echo "🧪 This RC release will be published to GitHub Marketplace as PRERELEASE"
24+
echo "👥 Users can reference: @v$VERSION for testing"
25+
fi
26+
27+
# Create workflow summary
28+
{
29+
echo "## 📦 Release Summary"
30+
echo "- **Version**: v$VERSION"
31+
echo "- **Type**: $RELEASE_TYPE"
32+
echo "- **Marketplace Status**: Published"
33+
echo "- **Release URL**: [$TAG_NAME](${{ github.server_url }}/${{ github.repository }}/releases/tag/$TAG_NAME)"
34+
} >> $GITHUB_STEP_SUMMARY
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
# .github/scripts/release/setup-release-vars.sh
3+
# Setup release variables based on workflow trigger
4+
5+
set -e
6+
7+
# Determine version and release type
8+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
9+
VERSION="${{ github.event.inputs.version }}"
10+
RELEASE_TYPE="${{ github.event.inputs.release_type }}"
11+
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then
12+
VERSION="${{ github.ref_name }}"
13+
VERSION="${VERSION#v}"
14+
if [[ "$VERSION" == *"-rc"* ]]; then
15+
RELEASE_TYPE="rc"
16+
else
17+
RELEASE_TYPE="stable"
18+
fi
19+
fi
20+
21+
# Validate version format
22+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$ ]]; then
23+
echo "Invalid version format: $VERSION"
24+
exit 1
25+
fi
26+
27+
# Set outputs
28+
echo "version=$VERSION" >> $GITHUB_OUTPUT
29+
echo "release_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT
30+
echo "tag_name=v$VERSION" >> $GITHUB_OUTPUT
31+
32+
if [[ "$RELEASE_TYPE" == "rc" ]]; then
33+
echo "is_prerelease=true" >> $GITHUB_OUTPUT
34+
else
35+
echo "is_prerelease=false" >> $GITHUB_OUTPUT
36+
fi
37+
38+
echo "🚀 Releasing version: $VERSION ($RELEASE_TYPE)"

0 commit comments

Comments
 (0)