|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + create_release: |
| 10 | + description: 'Create a release with artifacts' |
| 11 | + required: false |
| 12 | + default: 'false' |
| 13 | + |
| 14 | +env: |
| 15 | + BUILD_TYPE: Release |
| 16 | + |
| 17 | +jobs: |
| 18 | + build-macos: |
| 19 | + runs-on: macos-14 # Apple Silicon runner |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + submodules: recursive |
| 25 | + |
| 26 | + - name: Setup CMake |
| 27 | + uses: lukka/get-cmake@latest |
| 28 | + |
| 29 | + - name: Configure CMake |
| 30 | + run: | |
| 31 | + cmake -B build \ |
| 32 | + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ |
| 33 | + -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ |
| 34 | + -DJAMWIDE_UNIVERSAL=ON \ |
| 35 | + -DJAMWIDE_DEV_BUILD=OFF |
| 36 | +
|
| 37 | + - name: Build |
| 38 | + run: cmake --build build --config ${{ env.BUILD_TYPE }} -j $(sysctl -n hw.ncpu) |
| 39 | + |
| 40 | + - name: Package artifacts |
| 41 | + run: | |
| 42 | + mkdir -p artifacts/macos |
| 43 | + |
| 44 | + # Package CLAP |
| 45 | + cd build |
| 46 | + zip -r ../artifacts/macos/JamWide-macOS-CLAP.zip JamWide.clap |
| 47 | + |
| 48 | + # Package VST3 |
| 49 | + zip -r ../artifacts/macos/JamWide-macOS-VST3.zip JamWide.vst3 |
| 50 | + |
| 51 | + # Package AU |
| 52 | + zip -r ../artifacts/macos/JamWide-macOS-AU.zip JamWide.component |
| 53 | + |
| 54 | + # Create combined package |
| 55 | + zip -r ../artifacts/macos/JamWide-macOS-All.zip JamWide.clap JamWide.vst3 JamWide.component |
| 56 | +
|
| 57 | + - name: Upload macOS artifacts |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: JamWide-macOS |
| 61 | + path: artifacts/macos/*.zip |
| 62 | + retention-days: 30 |
| 63 | + |
| 64 | + build-windows: |
| 65 | + runs-on: windows-latest |
| 66 | + steps: |
| 67 | + - name: Checkout |
| 68 | + uses: actions/checkout@v4 |
| 69 | + with: |
| 70 | + submodules: recursive |
| 71 | + |
| 72 | + - name: Setup CMake |
| 73 | + uses: lukka/get-cmake@latest |
| 74 | + |
| 75 | + - name: Configure CMake |
| 76 | + run: | |
| 77 | + cmake -B build ` |
| 78 | + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} ` |
| 79 | + -DJAMWIDE_DEV_BUILD=OFF |
| 80 | +
|
| 81 | + - name: Build |
| 82 | + run: cmake --build build --config ${{ env.BUILD_TYPE }} -j $env:NUMBER_OF_PROCESSORS |
| 83 | + |
| 84 | + - name: Package artifacts |
| 85 | + shell: pwsh |
| 86 | + run: | |
| 87 | + New-Item -ItemType Directory -Force -Path artifacts/windows |
| 88 | + |
| 89 | + # Package CLAP |
| 90 | + Compress-Archive -Path build/${{ env.BUILD_TYPE }}/JamWide.clap -DestinationPath artifacts/windows/JamWide-Windows-CLAP.zip |
| 91 | + |
| 92 | + # Package VST3 |
| 93 | + Compress-Archive -Path build/${{ env.BUILD_TYPE }}/JamWide.vst3 -DestinationPath artifacts/windows/JamWide-Windows-VST3.zip |
| 94 | + |
| 95 | + # Create combined package |
| 96 | + Compress-Archive -Path build/${{ env.BUILD_TYPE }}/JamWide.clap, build/${{ env.BUILD_TYPE }}/JamWide.vst3 -DestinationPath artifacts/windows/JamWide-Windows-All.zip |
| 97 | +
|
| 98 | + - name: Upload Windows artifacts |
| 99 | + uses: actions/upload-artifact@v4 |
| 100 | + with: |
| 101 | + name: JamWide-Windows |
| 102 | + path: artifacts/windows/*.zip |
| 103 | + retention-days: 30 |
| 104 | + |
| 105 | + release: |
| 106 | + needs: [build-macos, build-windows] |
| 107 | + runs-on: ubuntu-latest |
| 108 | + if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.create_release == 'true' |
| 109 | + permissions: |
| 110 | + contents: write |
| 111 | + steps: |
| 112 | + - name: Checkout |
| 113 | + uses: actions/checkout@v4 |
| 114 | + |
| 115 | + - name: Download all artifacts |
| 116 | + uses: actions/download-artifact@v4 |
| 117 | + with: |
| 118 | + path: artifacts |
| 119 | + |
| 120 | + - name: Get version from tag |
| 121 | + id: get_version |
| 122 | + run: | |
| 123 | + if [[ "${{ github.ref }}" == refs/tags/* ]]; then |
| 124 | + VERSION=${GITHUB_REF#refs/tags/} |
| 125 | + else |
| 126 | + VERSION="dev-$(date +%Y%m%d-%H%M%S)" |
| 127 | + fi |
| 128 | + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT |
| 129 | +
|
| 130 | + - name: Generate release notes |
| 131 | + id: release_notes |
| 132 | + run: | |
| 133 | + # Get build number from source |
| 134 | + BUILD_NUM=$(grep -o 'JAMWIDE_BUILD_NUMBER [0-9]*' src/build_number.h | awk '{print $2}' || echo "unknown") |
| 135 | + |
| 136 | + cat << EOF > release_notes.md |
| 137 | + ## JamWide ${{ steps.get_version.outputs.VERSION }} |
| 138 | + |
| 139 | + **Build:** r${BUILD_NUM} |
| 140 | + |
| 141 | + ### Downloads |
| 142 | + |
| 143 | + #### macOS (Universal: Apple Silicon + Intel) |
| 144 | + - **JamWide-macOS-All.zip** - All formats (CLAP, VST3, AU) |
| 145 | + - **JamWide-macOS-CLAP.zip** - CLAP only |
| 146 | + - **JamWide-macOS-VST3.zip** - VST3 only |
| 147 | + - **JamWide-macOS-AU.zip** - Audio Unit only |
| 148 | + |
| 149 | + #### Windows (x64) |
| 150 | + - **JamWide-Windows-All.zip** - All formats (CLAP, VST3) |
| 151 | + - **JamWide-Windows-CLAP.zip** - CLAP only |
| 152 | + - **JamWide-Windows-VST3.zip** - VST3 only |
| 153 | + |
| 154 | + ### Installation |
| 155 | + |
| 156 | + **macOS:** |
| 157 | + - CLAP: \`~/Library/Audio/Plug-Ins/CLAP/\` |
| 158 | + - VST3: \`~/Library/Audio/Plug-Ins/VST3/\` |
| 159 | + - AU: \`~/Library/Audio/Plug-Ins/Components/\` |
| 160 | + |
| 161 | + **Windows:** |
| 162 | + - CLAP: \`C:\\Program Files\\Common Files\\CLAP\\\` |
| 163 | + - VST3: \`C:\\Program Files\\Common Files\\VST3\\\` |
| 164 | + |
| 165 | + --- |
| 166 | + |
| 167 | + ⚠️ **Early Development** - Not yet ready for production use |
| 168 | + EOF |
| 169 | +
|
| 170 | + - name: Create Release |
| 171 | + uses: softprops/action-gh-release@v2 |
| 172 | + with: |
| 173 | + name: JamWide ${{ steps.get_version.outputs.VERSION }} |
| 174 | + body_path: release_notes.md |
| 175 | + draft: false |
| 176 | + prerelease: true |
| 177 | + files: | |
| 178 | + artifacts/JamWide-macOS/*.zip |
| 179 | + artifacts/JamWide-Windows/*.zip |
| 180 | + env: |
| 181 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments