|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" # Trigger on any tag push |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: "Tag name to use for manual dispatch (e.g., v1.2.3)" |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + set_tag: |
| 15 | + name: Set Release Tag |
| 16 | + runs-on: ubuntu-latest |
| 17 | + outputs: |
| 18 | + tag: ${{ steps.set-tag.outputs.tag }} |
| 19 | + steps: |
| 20 | + - id: set-tag |
| 21 | + run: | |
| 22 | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
| 23 | + echo "::set-output name=tag::${{ github.event.inputs.tag }}" |
| 24 | + else |
| 25 | + echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" |
| 26 | + fi |
| 27 | + shell: bash |
| 28 | + |
| 29 | + build-linux: |
| 30 | + name: Build Linux (x64) |
| 31 | + if: false |
| 32 | + needs: set_tag |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + submodules: recursive |
| 39 | + - name: Install Dependencies |
| 40 | + run: | |
| 41 | + sudo apt-get update |
| 42 | + sudo apt-get install -y libgl1-mesa-dev mesa-common-dev libsdl2-dev libglm-dev ninja-build cmake g++ zip |
| 43 | + - name: Configure |
| 44 | + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON |
| 45 | + - name: Build & Install |
| 46 | + run: | |
| 47 | + cmake --build build --parallel |
| 48 | + cmake --install build --prefix install |
| 49 | + - name: Package |
| 50 | + run: | |
| 51 | + mkdir package |
| 52 | + cp -R install/* package/ |
| 53 | + tar -czvf projectm-${{ needs.set_tag.outputs.tag }}-linux-x64.tar.gz -C package . |
| 54 | + - name: Upload artifact |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: linux-x64 |
| 58 | + path: projectm-${{ needs.set_tag.outputs.tag }}-linux-x64.tar.gz |
| 59 | + |
| 60 | + build-macos: |
| 61 | + name: Build macOS (x64) |
| 62 | + if: false |
| 63 | + needs: set_tag |
| 64 | + runs-on: macos-latest |
| 65 | + steps: |
| 66 | + - name: Checkout |
| 67 | + uses: actions/checkout@v4 |
| 68 | + with: |
| 69 | + submodules: recursive |
| 70 | + - name: Install Dependencies |
| 71 | + run: brew install sdl2 ninja cmake |
| 72 | + - name: Configure |
| 73 | + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON |
| 74 | + - name: Build & Install |
| 75 | + run: | |
| 76 | + cmake --build build --parallel |
| 77 | + cmake --install build --prefix install |
| 78 | + - name: Package |
| 79 | + run: | |
| 80 | + mkdir package |
| 81 | + cp -R install/* package/ |
| 82 | + tar -czvf projectm-${{ needs.set_tag.outputs.tag }}-macos-x64.tar.gz -C package . |
| 83 | + - name: Upload artifact |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + with: |
| 86 | + name: macos-x64 |
| 87 | + path: projectm-${{ needs.set_tag.outputs.tag }}-macos-x64.tar.gz |
| 88 | + |
| 89 | + build-source: |
| 90 | + name: Package Source |
| 91 | + needs: set_tag |
| 92 | + runs-on: ubuntu-latest |
| 93 | + steps: |
| 94 | + - name: Checkout |
| 95 | + uses: actions/checkout@v4 |
| 96 | + with: |
| 97 | + submodules: recursive |
| 98 | + - name: Package Source |
| 99 | + run: | |
| 100 | + tar czvf projectm-${{ needs.set_tag.outputs.tag }}-source.tar.gz --exclude='.git*' . |
| 101 | + - name: Upload artifact |
| 102 | + uses: actions/upload-artifact@v4 |
| 103 | + with: |
| 104 | + name: source |
| 105 | + path: projectm-${{ needs.set_tag.outputs.tag }}-source.tar.gz |
| 106 | + |
| 107 | + build-windows: |
| 108 | + name: Build Windows (x64) |
| 109 | + needs: set_tag |
| 110 | + runs-on: windows-latest |
| 111 | + steps: |
| 112 | + - name: Checkout |
| 113 | + uses: actions/checkout@v4 |
| 114 | + with: |
| 115 | + submodules: recursive |
| 116 | + - name: Configure |
| 117 | + run: cmake -S . -B build -G "Visual Studio 17 2022" -A "x64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON |
| 118 | + - name: Build & Install |
| 119 | + run: cmake --build build --config Release --parallel --target INSTALL |
| 120 | + - name: Package |
| 121 | + shell: pwsh |
| 122 | + run: | |
| 123 | + $env:TAG = '${{ needs.set_tag.outputs.tag }}' |
| 124 | + New-Item -Path package -ItemType Directory -Force |
| 125 | + Copy-Item -Path install\\* -Destination package\\ -Recurse -Force |
| 126 | + Compress-Archive -Path package\\* -DestinationPath projectm-$env:TAG-windows-x64.zip |
| 127 | + - name: Upload artifact |
| 128 | + uses: actions/upload-artifact@v4 |
| 129 | + with: |
| 130 | + name: windows-x64 |
| 131 | + path: projectm-${{ needs.set_tag.outputs.tag }}-windows-x64.zip |
| 132 | + |
| 133 | + build-emscripten: |
| 134 | + name: Build Emscripten |
| 135 | + needs: set_tag |
| 136 | + runs-on: ubuntu-latest |
| 137 | + steps: |
| 138 | + - name: Checkout |
| 139 | + uses: actions/checkout@v4 |
| 140 | + with: |
| 141 | + submodules: recursive |
| 142 | + - name: Setup EMSDK |
| 143 | + uses: mymindstorm/setup-emsdk@v13 |
| 144 | + with: |
| 145 | + version: 3.1.53 |
| 146 | + actions-cache-folder: "emsdk-cache" |
| 147 | + - name: Install Dependencies |
| 148 | + run: | |
| 149 | + sudo apt-get update |
| 150 | + sudo apt-get install -y libgl1-mesa-dev mesa-common-dev libsdl2-dev libglm-dev ninja-build cmake g++ zip |
| 151 | + - name: Build GoogleTest |
| 152 | + run: | |
| 153 | + git clone https://github.com/projectM-visualizer/build-gtest.git build-gtest |
| 154 | + cd build-gtest && ./setup.sh && ./build-emscripten.sh |
| 155 | + - name: Configure |
| 156 | + run: emcmake cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=OFF -DGTest_DIR="build-gtest/dist/emscripten/lib/lib/cmake/GTest" |
| 157 | + - name: Build & Install |
| 158 | + run: | |
| 159 | + emmake cmake --build build --parallel |
| 160 | + cd build && emmake make install |
| 161 | + - name: Package |
| 162 | + run: | |
| 163 | + mkdir package |
| 164 | + cp -R install/* package/ |
| 165 | + zip -r projectm-${{ needs.set_tag.outputs.tag }}-emscripten.zip package |
| 166 | + - name: Upload artifact |
| 167 | + uses: actions/upload-artifact@v4 |
| 168 | + with: |
| 169 | + name: emscripten |
| 170 | + path: projectm-${{ needs.set_tag.outputs.tag }}-emscripten.zip |
| 171 | + |
| 172 | + release: |
| 173 | + name: Create GitHub Release |
| 174 | + needs: [set_tag, build-source, build-windows, build-emscripten] |
| 175 | + if: github.event_name == 'push' |
| 176 | + runs-on: ubuntu-latest |
| 177 | + steps: |
| 178 | + - name: Download artifacts |
| 179 | + uses: actions/download-artifact@v4 |
| 180 | + with: |
| 181 | + path: artifacts |
| 182 | + - name: Copy artifacts |
| 183 | + run: | |
| 184 | + mkdir release |
| 185 | + cp artifacts/*/* release/ |
| 186 | + - name: Create Release |
| 187 | + uses: softprops/action-gh-release@v1 |
| 188 | + with: |
| 189 | + tag_name: ${{ needs.set_tag.outputs.tag }} |
| 190 | + name: Release ${{ needs.set_tag.outputs.tag }} |
| 191 | + generate_release_notes: true |
| 192 | + draft: true |
| 193 | + prerelease: false |
| 194 | + files: | |
| 195 | + release/** |
0 commit comments