|
7 | 7 |
|
8 | 8 | permissions: |
9 | 9 | contents: write |
| 10 | + pull-requests: write |
10 | 11 |
|
11 | 12 | jobs: |
12 | | - release: |
13 | | - name: Create Release |
| 13 | + release-please: |
| 14 | + name: Release Please |
14 | 15 | 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 }} |
15 | 43 | steps: |
16 | 44 | - name: Checkout |
17 | 45 | uses: actions/checkout@v4 |
18 | | - with: |
19 | | - fetch-depth: 0 |
20 | 46 |
|
21 | 47 | - name: Validate Scripts |
22 | 48 | run: | |
23 | | - echo "Validating shell scripts..." |
| 49 | + echo "🚀 Validating ${{ needs.release-please.outputs.tag_name }}..." |
24 | 50 | bash -n install.sh |
25 | 51 | bash -n uninstall.sh |
26 | 52 | 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 }} |
0 commit comments