Skip to content

Commit 6d8e304

Browse files
authored
Merge pull request #3 from draphy/draphy/dro-64-test-draphyos-and-optimize
chore: [DRO-64] Update workflow for release
2 parents 10e8f5a + 937cc22 commit 6d8e304

2 files changed

Lines changed: 32 additions & 64 deletions

File tree

.github/workflows/release.yml

Lines changed: 31 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,79 +7,46 @@ on:
77

88
permissions:
99
contents: write
10+
pull-requests: write
1011

1112
jobs:
12-
release:
13-
name: Create Release
13+
release-please:
14+
name: Release Please
1415
runs-on: ubuntu-latest
16+
outputs:
17+
release_created: ${{ steps.release.outputs.release_created }}
18+
tag_name: ${{ steps.release.outputs.tag_name }}
19+
pr: ${{ steps.release.outputs.pr }}
20+
steps:
21+
- name: Release Please
22+
id: release
23+
uses: googleapis/release-please-action@v4
24+
with:
25+
release-type: simple
26+
include-v-in-tag: true
27+
changelog-types: >
28+
[
29+
{"type": "feat", "section": "Features", "hidden": false},
30+
{"type": "fix", "section": "Bug Fixes", "hidden": false},
31+
{"type": "perf", "section": "Performance", "hidden": false},
32+
{"type": "docs", "section": "Documentation", "hidden": false},
33+
{"type": "chore", "section": "Maintenance", "hidden": true},
34+
{"type": "style", "section": "Styles", "hidden": true},
35+
{"type": "refactor", "section": "Refactoring", "hidden": true}
36+
]
37+
38+
validate:
39+
name: Validate Release
40+
runs-on: ubuntu-latest
41+
needs: release-please
42+
if: ${{ needs.release-please.outputs.release_created }}
1543
steps:
1644
- name: Checkout
1745
uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
2046

2147
- name: Validate Scripts
2248
run: |
23-
echo "Validating shell scripts..."
49+
echo "🚀 Validating ${{ needs.release-please.outputs.tag_name }}..."
2450
bash -n install.sh
2551
bash -n uninstall.sh
2652
echo "✅ Scripts are valid"
27-
28-
- name: Generate Version
29-
id: version
30-
run: |
31-
# Date-based versioning (Ubuntu-style): vYYYY.MM or vYYYY.MM.patch
32-
BASE_VERSION="v$(date +%Y.%m)"
33-
34-
# Check if this version tag already exists
35-
EXISTING=$(git tag -l "${BASE_VERSION}*" | sort -V | tail -1)
36-
37-
if [ -z "$EXISTING" ]; then
38-
VERSION="$BASE_VERSION"
39-
elif [ "$EXISTING" = "$BASE_VERSION" ]; then
40-
VERSION="${BASE_VERSION}.1"
41-
else
42-
# Extract patch number and increment
43-
PATCH=$(echo "$EXISTING" | sed "s/${BASE_VERSION}\.//")
44-
VERSION="${BASE_VERSION}.$((PATCH + 1))"
45-
fi
46-
47-
echo "version=$VERSION" >> $GITHUB_OUTPUT
48-
echo "Generated version: $VERSION"
49-
50-
- name: Generate Release Notes
51-
run: |
52-
# Get the latest release tag
53-
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
54-
55-
echo "## What's Changed" > RELEASE_NOTES.md
56-
echo "" >> RELEASE_NOTES.md
57-
58-
if [ -n "$PREV_TAG" ]; then
59-
# Generate changelog from commits since last release
60-
git log --pretty=format:"- %s (%h)" $PREV_TAG..HEAD >> RELEASE_NOTES.md
61-
else
62-
# First release - show recent commits
63-
git log --pretty=format:"- %s (%h)" -20 >> RELEASE_NOTES.md
64-
fi
65-
66-
echo "" >> RELEASE_NOTES.md
67-
echo "" >> RELEASE_NOTES.md
68-
echo "## Installation" >> RELEASE_NOTES.md
69-
echo "" >> RELEASE_NOTES.md
70-
echo '```bash' >> RELEASE_NOTES.md
71-
echo 'curl -fsSL https://raw.githubusercontent.com/draphy/draphyOS/latest/install.sh | bash' >> RELEASE_NOTES.md
72-
echo '```' >> RELEASE_NOTES.md
73-
74-
echo "--- Release Notes ---"
75-
cat RELEASE_NOTES.md
76-
77-
- name: Create GitHub Release
78-
uses: softprops/action-gh-release@v2
79-
with:
80-
tag_name: ${{ steps.version.outputs.version }}
81-
name: ${{ steps.version.outputs.version }}
82-
body_path: RELEASE_NOTES.md
83-
make_latest: true
84-
env:
85-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
</p>
1111

1212
<p align="center">
13+
<a href="https://github.com/draphy/draphyOS/releases/latest"><img src="https://img.shields.io/github/v/release/draphy/draphyOS?style=flat&color=9ab87c" alt="Release"></a>
1314
<a href="https://fedoraproject.org/spins/i3/"><img src="https://img.shields.io/badge/Fedora-i3_Spin-51A2DA?style=flat&logo=fedora" alt="Fedora i3"></a>
1415
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License"></a>
1516
<a href="https://github.com/draphy/draphyOS"><img src="https://img.shields.io/badge/Shell-Bash-4EAA25?logo=gnu-bash&logoColor=white" alt="Bash"></a>

0 commit comments

Comments
 (0)