|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + # First, trigger builds for all platforms |
| 13 | + build: |
| 14 | + uses: ./.github/workflows/ci.yml |
| 15 | + |
| 16 | + create-release: |
| 17 | + needs: build |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Verify tag format |
| 26 | + run: | |
| 27 | + if [[ ! "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 28 | + echo "Error: Tag must be in format v*.*.* (e.g., v1.0.0)" |
| 29 | + exit 1 |
| 30 | + fi |
| 31 | +
|
| 32 | + - name: Extract version info |
| 33 | + id: version |
| 34 | + run: | |
| 35 | + VERSION="${{ github.ref_name }}" |
| 36 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 37 | + echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT |
| 38 | +
|
| 39 | + - name: Download all artifacts |
| 40 | + uses: actions/download-artifact@v4 |
| 41 | + with: |
| 42 | + path: artifacts |
| 43 | + |
| 44 | + - name: Create artifact archives |
| 45 | + run: | |
| 46 | + cd artifacts |
| 47 | + for dir in */; do |
| 48 | + dirname="${dir%/}" |
| 49 | + tar -czf "${dirname}.tar.gz" -C "$dirname" . |
| 50 | + zip -r "${dirname}.zip" "$dirname" |
| 51 | + done |
| 52 | + cd .. |
| 53 | +
|
| 54 | + - name: Generate release notes |
| 55 | + id: notes |
| 56 | + run: | |
| 57 | + # Get the previous tag |
| 58 | + PREV_TAG=$(git describe --tags --abbrev=0 ${{ github.ref_name }}^ 2>/dev/null || echo "") |
| 59 | +
|
| 60 | + if [ -z "$PREV_TAG" ]; then |
| 61 | + echo "This is the first release" |
| 62 | + CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${{ github.ref_name }}) |
| 63 | + else |
| 64 | + echo "Changes since $PREV_TAG" |
| 65 | + CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${PREV_TAG}..${{ github.ref_name }}) |
| 66 | + fi |
| 67 | +
|
| 68 | + # Save to file to handle multiline |
| 69 | + cat > release_notes.md << 'EOF' |
| 70 | + ## 📦 Release ${{ steps.version.outputs.version }} |
| 71 | +
|
| 72 | + ### Changes in this release |
| 73 | +
|
| 74 | + $CHANGELOG |
| 75 | +
|
| 76 | + ### 📦 Pre-built Binaries |
| 77 | +
|
| 78 | + Download the appropriate archive for your platform: |
| 79 | +
|
| 80 | + - **Linux GCC 14**: `EntropyCore-Linux-gcc-14.tar.gz` / `.zip` |
| 81 | + - **macOS Universal**: `EntropyCore-macOS-universal.tar.gz` / `.zip` (Intel + Apple Silicon) |
| 82 | + - **Windows x64**: `EntropyCore-Windows-x64.tar.gz` / `.zip` |
| 83 | +
|
| 84 | + Each archive contains: |
| 85 | + - **lib/**: Static library (`libEntropyCore.a` or `EntropyCore.lib`) |
| 86 | + - **include/**: All C++ and C headers |
| 87 | + - **lib/cmake/EntropyCore/**: CMake config files |
| 88 | +
|
| 89 | + Extract and use in your project: |
| 90 | + ```cmake |
| 91 | + find_package(EntropyCore REQUIRED PATHS /path/to/extracted/lib/cmake/EntropyCore) |
| 92 | + target_link_libraries(YourTarget PRIVATE EntropyCore::Core) |
| 93 | + ``` |
| 94 | +
|
| 95 | + ### 🔧 Building from Source |
| 96 | +
|
| 97 | + ```bash |
| 98 | + # Clone the repository |
| 99 | + git clone https://github.com/${{ github.repository }}.git |
| 100 | + cd EntropyCore |
| 101 | + git checkout ${{ github.ref_name }} |
| 102 | +
|
| 103 | + # Basic build (minimal dependencies) |
| 104 | + cmake -B build -S . |
| 105 | + cmake --build build |
| 106 | +
|
| 107 | + # With Tracy profiler |
| 108 | + cmake -B build -S . -DENTROPY_WITH_TRACY=ON -DVCPKG_MANIFEST_FEATURES=tracy |
| 109 | +
|
| 110 | + # With tests |
| 111 | + cmake -B build -S . -DENTROPY_BUILD_TESTS=ON -DVCPKG_MANIFEST_FEATURES=tests |
| 112 | + ``` |
| 113 | +
|
| 114 | + ### 📚 Documentation |
| 115 | +
|
| 116 | + See [README.md](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/README.md) for complete documentation. |
| 117 | +
|
| 118 | + ### 🐛 Reporting Issues |
| 119 | +
|
| 120 | + Found a bug? [Open an issue](https://github.com/${{ github.repository }}/issues/new) |
| 121 | + EOF |
| 122 | +
|
| 123 | + - name: Create Release |
| 124 | + uses: softprops/action-gh-release@v2 |
| 125 | + with: |
| 126 | + name: "Release ${{ steps.version.outputs.version }}" |
| 127 | + body_path: release_notes.md |
| 128 | + files: | |
| 129 | + artifacts/*.tar.gz |
| 130 | + artifacts/*.zip |
| 131 | + draft: false |
| 132 | + prerelease: false |
| 133 | + make_latest: true |
| 134 | + generate_release_notes: true |
| 135 | + |
| 136 | + - name: Announce release |
| 137 | + run: | |
| 138 | + echo "✅ Release ${{ steps.version.outputs.version }} created successfully!" |
| 139 | + echo "🔗 View at: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}" |
0 commit comments