Skip to content

Commit 74a6288

Browse files
authored
Merge pull request #62 from azadshaikh/main
merge with main repo
2 parents e8e8303 + 37e8afe commit 74a6288

3 files changed

Lines changed: 165 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,25 @@ jobs:
3636
- name: Build distribution files
3737
run: npm run build
3838

39+
- name: Verify build output
40+
run: |
41+
echo "📁 Contents of dist directory:"
42+
ls -la dist/
43+
echo ""
44+
echo "🔍 Checking subdirectories:"
45+
find dist/ -type f -name "*" | head -20
46+
echo ""
47+
echo "📊 Total files built:"
48+
find dist/ -type f | wc -l
49+
3950
- name: Zip distribution files
40-
uses: montudor/action-zip@v1
41-
with:
42-
args: 'zip -qq astero-admin-${{env.RELEASE_VERSION}}.zip dist'
51+
run: |
52+
echo "🗜️ Creating zip file..."
53+
cd dist
54+
zip -r ../astero-admin-${{env.RELEASE_VERSION}}.zip . -x "*.DS_Store" "*/.DS_Store"
55+
cd ..
56+
echo "✅ Zip file created:"
57+
ls -la astero-admin-${{env.RELEASE_VERSION}}.zip
4358
4459
- name: Generate awesome changelog
4560
id: changelog
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: '📝 Update Changelog'
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to generate changelog for'
10+
required: false
11+
default: 'latest'
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
jobs:
18+
update-changelog:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: 📥 Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
ref: main
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: 🏷️ Get release info
29+
id: release_info
30+
run: |
31+
if [ "${{ github.event_name }}" = "release" ]; then
32+
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
33+
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
34+
echo "${{ github.event.release.body }}" >> $GITHUB_OUTPUT
35+
echo "EOF" >> $GITHUB_OUTPUT
36+
echo "release_date=$(date -d '${{ github.event.release.published_at }}' '+%Y-%m-%d')" >> $GITHUB_OUTPUT
37+
else
38+
LATEST_TAG=$(git describe --tags --abbrev=0)
39+
echo "version=${LATEST_TAG}" >> $GITHUB_OUTPUT
40+
echo "release_date=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT
41+
echo "release_notes=Manual changelog update" >> $GITHUB_OUTPUT
42+
fi
43+
44+
- name: 📝 Update CHANGELOG.md
45+
id: update_changelog
46+
run: |
47+
VERSION="${{ steps.release_info.outputs.version }}"
48+
RELEASE_DATE="${{ steps.release_info.outputs.release_date }}"
49+
RELEASE_NOTES="${{ steps.release_info.outputs.release_notes }}"
50+
51+
# Create CHANGELOG.md if it doesn't exist
52+
if [ ! -f CHANGELOG.md ]; then
53+
cat > CHANGELOG.md << 'EOF'
54+
# Changelog
55+
56+
All notable changes to this project will be documented in this file.
57+
58+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
59+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
60+
61+
EOF
62+
fi
63+
64+
# Prepare the new entry
65+
NEW_ENTRY=$(cat << EOF
66+
67+
## [${VERSION}] - ${RELEASE_DATE}
68+
69+
${RELEASE_NOTES}
70+
71+
EOF
72+
)
73+
74+
# Check if this version already exists
75+
if grep -q "## \[${VERSION}\]" CHANGELOG.md; then
76+
echo "Version ${VERSION} already exists in changelog"
77+
echo "changes=false" >> $GITHUB_OUTPUT
78+
else
79+
# Insert new entry after the header (before the first ## entry)
80+
if grep -q "^## \[" CHANGELOG.md; then
81+
# Find the first release entry and insert before it
82+
awk -v new_entry="$NEW_ENTRY" '
83+
/^## \[/ && !inserted {
84+
print new_entry
85+
inserted = 1
86+
}
87+
{ print }
88+
' CHANGELOG.md > CHANGELOG.tmp && mv CHANGELOG.tmp CHANGELOG.md
89+
else
90+
# No releases yet, append to end
91+
echo "$NEW_ENTRY" >> CHANGELOG.md
92+
fi
93+
echo "changes=true" >> $GITHUB_OUTPUT
94+
echo "✅ Added ${VERSION} to CHANGELOG.md"
95+
fi
96+
97+
- name: 🔍 Show changelog changes
98+
if: steps.update_changelog.outputs.changes == 'true'
99+
run: |
100+
echo "📄 Updated CHANGELOG.md:"
101+
echo "----------------------------------------"
102+
head -30 CHANGELOG.md
103+
104+
- name: 💾 Commit changes
105+
if: steps.update_changelog.outputs.changes == 'true'
106+
run: |
107+
git config --local user.email "action@github.com"
108+
git config --local user.name "GitHub Action"
109+
git add CHANGELOG.md
110+
git commit -m "📝 Update CHANGELOG.md for ${{ steps.release_info.outputs.version }}" || exit 0
111+
git push
112+
113+
- name: ✅ Summary
114+
run: |
115+
if [ "${{ steps.update_changelog.outputs.changes }}" = "true" ]; then
116+
echo "🎉 Successfully updated CHANGELOG.md with version ${{ steps.release_info.outputs.version }}"
117+
else
118+
echo "ℹ️ No changes needed - version already exists in changelog"
119+
fi

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Automatic changelog management with GitHub Actions
12+
- Professional release notes generation
13+
- Enhanced build process with verification steps
14+
15+
### Changed
16+
- Improved zip file packaging for releases
17+
- Updated release workflow with better changelog generation
18+
19+
### Fixed
20+
- Empty dist folder issue in release zip files
21+
22+
## [1.0.8] - 2024-01-XX
23+
24+
### Added
25+
- Initial release of Astero Admin Template
26+
- Bootstrap 5 admin template
27+
- Responsive design
28+
- Modern UI components

0 commit comments

Comments
 (0)