|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + create-release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + |
| 20 | + - name: Verify tag format |
| 21 | + run: | |
| 22 | + if [[ ! "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 23 | + echo "Error: Tag must be in format v*.*.* (e.g., v1.0.0)" |
| 24 | + exit 1 |
| 25 | + fi |
| 26 | +
|
| 27 | + - name: Extract version info |
| 28 | + id: version |
| 29 | + run: | |
| 30 | + VERSION="${{ github.ref_name }}" |
| 31 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 32 | + echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT |
| 33 | +
|
| 34 | + - name: Generate release notes |
| 35 | + id: notes |
| 36 | + run: | |
| 37 | + # Get the previous tag |
| 38 | + PREV_TAG=$(git describe --tags --abbrev=0 ${{ github.ref_name }}^ 2>/dev/null || echo "") |
| 39 | +
|
| 40 | + if [ -z "$PREV_TAG" ]; then |
| 41 | + echo "This is the first release" |
| 42 | + CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${{ github.ref_name }}) |
| 43 | + else |
| 44 | + echo "Changes since $PREV_TAG" |
| 45 | + CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${PREV_TAG}..${{ github.ref_name }}) |
| 46 | + fi |
| 47 | +
|
| 48 | + # Save to file to handle multiline |
| 49 | + cat > release_notes.md << 'EOF' |
| 50 | + ## 📦 Release ${{ steps.version.outputs.version }} |
| 51 | +
|
| 52 | + ### Changes in this release |
| 53 | +
|
| 54 | + $CHANGELOG |
| 55 | +
|
| 56 | + ### 🔧 Building from Source |
| 57 | +
|
| 58 | + ```bash |
| 59 | + # Clone the repository |
| 60 | + git clone https://github.com/${{ github.repository }}.git |
| 61 | + cd EntropyCore |
| 62 | + git checkout ${{ github.ref_name }} |
| 63 | +
|
| 64 | + # Basic build (minimal dependencies) |
| 65 | + cmake -B build -S . |
| 66 | + cmake --build build |
| 67 | +
|
| 68 | + # With Tracy profiler |
| 69 | + cmake -B build -S . -DENTROPY_WITH_TRACY=ON -DVCPKG_MANIFEST_FEATURES=tracy |
| 70 | +
|
| 71 | + # With tests |
| 72 | + cmake -B build -S . -DENTROPY_BUILD_TESTS=ON -DVCPKG_MANIFEST_FEATURES=tests |
| 73 | + ``` |
| 74 | +
|
| 75 | + ### 📚 Documentation |
| 76 | +
|
| 77 | + See [README.md](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/README.md) for complete documentation. |
| 78 | +
|
| 79 | + ### 🐛 Reporting Issues |
| 80 | +
|
| 81 | + Found a bug? [Open an issue](https://github.com/${{ github.repository }}/issues/new) |
| 82 | + EOF |
| 83 | +
|
| 84 | + - name: Create Release |
| 85 | + uses: softprops/action-gh-release@v2 |
| 86 | + with: |
| 87 | + name: "Release ${{ steps.version.outputs.version }}" |
| 88 | + body_path: release_notes.md |
| 89 | + draft: false |
| 90 | + prerelease: false |
| 91 | + make_latest: true |
| 92 | + generate_release_notes: true |
| 93 | + |
| 94 | + - name: Announce release |
| 95 | + run: | |
| 96 | + echo "✅ Release ${{ steps.version.outputs.version }} created successfully!" |
| 97 | + echo "🔗 View at: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}" |
0 commit comments