diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40c692e..5c887f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/README.md b/README.md index 0b7c266..761d45d 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@