|
| 1 | +name: Release Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + create-release: |
| 10 | + name: Create Draft Release |
| 11 | + runs-on: ubuntu-latest |
| 12 | + outputs: |
| 13 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 14 | + steps: |
| 15 | + - name: Create Release |
| 16 | + id: create_release |
| 17 | + uses: actions/create-release@v1 |
| 18 | + env: |
| 19 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + with: |
| 21 | + tag_name: ${{ github.ref_name }} |
| 22 | + release_name: Release ${{ github.ref_name }} |
| 23 | + draft: true |
| 24 | + prerelease: false |
| 25 | + |
| 26 | + build-windows: |
| 27 | + name: Build & Upload Windows Release |
| 28 | + runs-on: windows-latest |
| 29 | + needs: create-release |
| 30 | + steps: |
| 31 | + - name: Checkout Code |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Install Rust |
| 35 | + uses: dtolnay/rust-toolchain@stable |
| 36 | + with: |
| 37 | + targets: wasm32-unknown-unknown |
| 38 | + |
| 39 | + - name: Set up MSVC & Developer Command Prompt |
| 40 | + uses: ilammy/msvc-dev-cmd@v1 |
| 41 | + |
| 42 | + - name: Set up CMake & Ninja |
| 43 | + uses: lukka/get-cmake@latest |
| 44 | + |
| 45 | + - name: Build Rust Static Library |
| 46 | + working-directory: plug.app/rt |
| 47 | + run: cargo build --release --lib |
| 48 | + |
| 49 | + - name: Build WASM Plugins |
| 50 | + run: | |
| 51 | + mkdir release_pkg |
| 52 | + mkdir release_pkg/plugins |
| 53 | + rustc --target wasm32-unknown-unknown --crate-type cdylib plug.app/rt/src_plugins/pTerm/pTerm.rs -o release_pkg/plugins/pTerm.wasm -C opt-level=z -C lto=true |
| 54 | + cp plug.app/rt/src_plugins/plugin.toml release_pkg/plugins/plugin.toml |
| 55 | +
|
| 56 | + - name: Run CMake Configuration |
| 57 | + run: | |
| 58 | + cmake -G Ninja -S plug.cross/windows -B plug.cross/windows/build -DRUST_LIB_PATH=../../plug.app/rt/target/release/tm_main.lib -DCMAKE_BUILD_TYPE=Release |
| 59 | +
|
| 60 | + - name: Compile plug executable |
| 61 | + run: | |
| 62 | + cmake --build plug.cross/windows/build |
| 63 | +
|
| 64 | + - name: Prepare Package |
| 65 | + run: | |
| 66 | + cp plug.cross/windows/build/plug.exe release_pkg/plug.exe |
| 67 | + cp LICENSE release_pkg/LICENSE |
| 68 | + cp README.md release_pkg/README.md |
| 69 | + compress-archive -Path release_pkg/* -DestinationPath plug-windows-x64.zip |
| 70 | +
|
| 71 | + - name: Upload Windows Asset |
| 72 | + uses: actions/upload-release-asset@v1 |
| 73 | + env: |
| 74 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + with: |
| 76 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 77 | + asset_path: ./plug-windows-x64.zip |
| 78 | + asset_name: plug-windows-x64.zip |
| 79 | + asset_content_type: application/zip |
| 80 | + |
| 81 | + build-linux: |
| 82 | + name: Build & Upload Linux Release |
| 83 | + runs-on: ubuntu-latest |
| 84 | + needs: create-release |
| 85 | + steps: |
| 86 | + - name: Checkout Code |
| 87 | + uses: actions/checkout@v4 |
| 88 | + |
| 89 | + - name: Install Rust |
| 90 | + uses: dtolnay/rust-toolchain@stable |
| 91 | + with: |
| 92 | + targets: wasm32-unknown-unknown |
| 93 | + |
| 94 | + - name: Install GTK4 Dependencies |
| 95 | + run: | |
| 96 | + sudo apt-get update |
| 97 | + sudo apt-get install -y libgtk-4-dev pkg-config ninja-build libx11-dev |
| 98 | +
|
| 99 | + - name: Build Rust Static Library |
| 100 | + working-directory: plug.app/rt |
| 101 | + run: cargo build --release --lib |
| 102 | + |
| 103 | + - name: Build WASM Plugins |
| 104 | + run: | |
| 105 | + mkdir -p release_pkg/plugins |
| 106 | + rustc --target wasm32-unknown-unknown --crate-type cdylib plug.app/rt/src_plugins/pTerm/pTerm.rs -o release_pkg/plugins/pTerm.wasm -C opt-level=z -C lto=true |
| 107 | + cp plug.app/rt/src_plugins/plugin.toml release_pkg/plugins/plugin.toml |
| 108 | +
|
| 109 | + - name: Run CMake Configuration |
| 110 | + run: | |
| 111 | + cmake -G Ninja -S plug.cross/linux -B plug.cross/linux/build -DRUST_LIB_PATH=../../plug.app/rt/target/release/libtm_main.a -DCMAKE_BUILD_TYPE=Release |
| 112 | +
|
| 113 | + - name: Compile plug executable |
| 114 | + run: | |
| 115 | + cmake --build plug.cross/linux/build |
| 116 | +
|
| 117 | + - name: Prepare Package |
| 118 | + run: | |
| 119 | + cp plug.cross/linux/build/plug release_pkg/plug |
| 120 | + cp LICENSE release_pkg/LICENSE |
| 121 | + cp README.md release_pkg/README.md |
| 122 | + zip -r plug-linux-x64.zip release_pkg/* |
| 123 | +
|
| 124 | + - name: Upload Linux Asset |
| 125 | + uses: actions/upload-release-asset@v1 |
| 126 | + env: |
| 127 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 128 | + with: |
| 129 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 130 | + asset_path: ./plug-linux-x64.zip |
| 131 | + asset_name: plug-linux-x64.zip |
| 132 | + asset_content_type: application/zip |
0 commit comments