Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 31 additions & 64 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,79 +7,46 @@ on:

permissions:
contents: write
pull-requests: write

jobs:
release:
name: Create Release
release-please:
name: Release Please
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
pr: ${{ steps.release.outputs.pr }}
steps:
- name: Release Please
id: release
uses: googleapis/release-please-action@v4
with:
release-type: simple
include-v-in-tag: true
changelog-types: >
[
{"type": "feat", "section": "Features", "hidden": false},
{"type": "fix", "section": "Bug Fixes", "hidden": false},
{"type": "perf", "section": "Performance", "hidden": false},
{"type": "docs", "section": "Documentation", "hidden": false},
{"type": "chore", "section": "Maintenance", "hidden": true},
{"type": "style", "section": "Styles", "hidden": true},
{"type": "refactor", "section": "Refactoring", "hidden": true}
]

validate:
name: Validate Release
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Validate Scripts
run: |
echo "Validating shell scripts..."
echo "🚀 Validating ${{ needs.release-please.outputs.tag_name }}..."
bash -n install.sh
bash -n uninstall.sh
echo "✅ Scripts are valid"

- name: Generate Version
id: version
run: |
# Date-based versioning (Ubuntu-style): vYYYY.MM or vYYYY.MM.patch
BASE_VERSION="v$(date +%Y.%m)"

# Check if this version tag already exists
EXISTING=$(git tag -l "${BASE_VERSION}*" | sort -V | tail -1)

if [ -z "$EXISTING" ]; then
VERSION="$BASE_VERSION"
elif [ "$EXISTING" = "$BASE_VERSION" ]; then
VERSION="${BASE_VERSION}.1"
else
# Extract patch number and increment
PATCH=$(echo "$EXISTING" | sed "s/${BASE_VERSION}\.//")
VERSION="${BASE_VERSION}.$((PATCH + 1))"
fi

echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Generated version: $VERSION"

- name: Generate Release Notes
run: |
# Get the latest release tag
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")

echo "## What's Changed" > RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md

if [ -n "$PREV_TAG" ]; then
# Generate changelog from commits since last release
git log --pretty=format:"- %s (%h)" $PREV_TAG..HEAD >> RELEASE_NOTES.md
else
# First release - show recent commits
git log --pretty=format:"- %s (%h)" -20 >> RELEASE_NOTES.md
fi

echo "" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "## Installation" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo '```bash' >> RELEASE_NOTES.md
echo 'curl -fsSL https://raw.githubusercontent.com/draphy/draphyOS/latest/install.sh | bash' >> RELEASE_NOTES.md
echo '```' >> RELEASE_NOTES.md

echo "--- Release Notes ---"
cat RELEASE_NOTES.md

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
body_path: RELEASE_NOTES.md
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</p>

<p align="center">
<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>
<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>
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License"></a>
<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>
Expand Down