|
| 1 | +# Copyright 2026 openGemini Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | + |
| 16 | +name: Wails build |
| 17 | + |
| 18 | +on: |
| 19 | + push: |
| 20 | + branches: |
| 21 | + - main |
| 22 | + tags: |
| 23 | + - 'v*' |
| 24 | + |
| 25 | +env: |
| 26 | + # Necessary for most environments as build failure can occur due to OOM issues |
| 27 | + NODE_OPTIONS: "--max-old-space-size=4096" |
| 28 | + |
| 29 | +jobs: |
| 30 | + build: |
| 31 | + strategy: |
| 32 | + # Failure in one platform build won't impact the others |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + build: |
| 36 | + - name: 'openGemini-studio' |
| 37 | + platform: 'linux/amd64' |
| 38 | + os: 'ubuntu-latest' |
| 39 | + - name: 'openGemini-studio' |
| 40 | + platform: 'windows/amd64' |
| 41 | + os: 'windows-latest' |
| 42 | + - name: 'openGemini-studio' |
| 43 | + platform: 'darwin/universal' |
| 44 | + os: 'macos-latest' |
| 45 | + |
| 46 | + runs-on: ${{ matrix.build.os }} |
| 47 | + steps: |
| 48 | + - name: Checkout |
| 49 | + uses: actions/checkout@v4 |
| 50 | + with: |
| 51 | + submodules: recursive |
| 52 | + |
| 53 | + - name: Setup Go |
| 54 | + uses: actions/setup-go@v5 |
| 55 | + with: |
| 56 | + go-version: '1.24' |
| 57 | + |
| 58 | + - name: Setup Node |
| 59 | + uses: actions/setup-node@v4 |
| 60 | + with: |
| 61 | + node-version: '24' |
| 62 | + |
| 63 | + - name: Install Linux dependencies |
| 64 | + if: runner.os == 'Linux' |
| 65 | + run: | |
| 66 | + sudo apt-get update |
| 67 | + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev |
| 68 | +
|
| 69 | + - name: Install Wails |
| 70 | + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest |
| 71 | + |
| 72 | + - name: Build Application |
| 73 | + run: wails build -platform ${{ matrix.build.platform }} -tags webkit2_41 -clean |
| 74 | + |
| 75 | + - name: Prepare artifacts (Linux) |
| 76 | + if: runner.os == 'Linux' |
| 77 | + run: | |
| 78 | + cd build/bin |
| 79 | + tar -czf openGemini-studio-linux-amd64.tar.gz openGemini-studio |
| 80 | +
|
| 81 | + - name: Prepare artifacts (Windows) |
| 82 | + if: runner.os == 'Windows' |
| 83 | + shell: pwsh |
| 84 | + run: | |
| 85 | + cd build/bin |
| 86 | + Compress-Archive -Path openGemini-studio.exe -DestinationPath openGemini-studio-windows-amd64.zip |
| 87 | +
|
| 88 | + - name: Prepare artifacts (macOS) |
| 89 | + if: runner.os == 'macOS' |
| 90 | + run: | |
| 91 | + cd build/bin |
| 92 | + tar -czf openGemini-studio-darwin-universal.tar.gz openGemini-studio.app |
| 93 | +
|
| 94 | + - name: Upload artifacts |
| 95 | + uses: actions/upload-artifact@v4 |
| 96 | + with: |
| 97 | + name: ${{ matrix.build.name }}-${{ runner.os }}-${{ runner.arch }} |
| 98 | + path: | |
| 99 | + build/bin/*.tar.gz |
| 100 | + build/bin/*.zip |
| 101 | +
|
| 102 | + release: |
| 103 | + needs: build |
| 104 | + runs-on: ubuntu-latest |
| 105 | + if: github.event_name == 'push' |
| 106 | + permissions: |
| 107 | + contents: write |
| 108 | + steps: |
| 109 | + - name: Checkout |
| 110 | + uses: actions/checkout@v4 |
| 111 | + with: |
| 112 | + fetch-depth: 0 |
| 113 | + |
| 114 | + - name: Download all artifacts |
| 115 | + uses: actions/download-artifact@v4 |
| 116 | + with: |
| 117 | + path: artifacts |
| 118 | + |
| 119 | + - name: Display structure of downloaded files |
| 120 | + run: ls -R artifacts |
| 121 | + |
| 122 | + - name: Collect all release files |
| 123 | + run: | |
| 124 | + mkdir -p release-files |
| 125 | + find artifacts -name "*.tar.gz" -exec cp {} release-files/ \; |
| 126 | + find artifacts -name "*.zip" -exec cp {} release-files/ \; |
| 127 | + ls -lh release-files/ |
| 128 | +
|
| 129 | + - name: Determine release info |
| 130 | + id: release_info |
| 131 | + run: | |
| 132 | + if [[ "${{ github.ref }}" == refs/tags/v* ]]; then |
| 133 | + # Tag release |
| 134 | + TAG_NAME="${GITHUB_REF#refs/tags/}" |
| 135 | + echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT |
| 136 | + echo "release_name=${TAG_NAME}" >> $GITHUB_OUTPUT |
| 137 | + echo "prerelease=false" >> $GITHUB_OUTPUT |
| 138 | + echo "is_nightly=false" >> $GITHUB_OUTPUT |
| 139 | + else |
| 140 | + # Nightly release from main branch |
| 141 | + echo "tag_name=nightly" >> $GITHUB_OUTPUT |
| 142 | + echo "release_name=Nightly Build" >> $GITHUB_OUTPUT |
| 143 | + echo "prerelease=true" >> $GITHUB_OUTPUT |
| 144 | + echo "is_nightly=true" >> $GITHUB_OUTPUT |
| 145 | + fi |
| 146 | +
|
| 147 | + - name: Generate release body |
| 148 | + id: release_body |
| 149 | + run: | |
| 150 | + if [[ "${{ steps.release_info.outputs.is_nightly }}" == "true" ]]; then |
| 151 | + cat << 'EOF' > release_body.md |
| 152 | + 🌙 **Nightly Build** |
| 153 | +
|
| 154 | + This is an automated nightly build from the main branch. |
| 155 | +
|
| 156 | + **Build Information:** |
| 157 | + - Commit: ${{ github.sha }} |
| 158 | + - Build Date: ${{ github.event.head_commit.timestamp }} |
| 159 | + - Commit Message: ${{ github.event.head_commit.message }} |
| 160 | + - Branch: main |
| 161 | +
|
| 162 | + ## 📦 Downloads |
| 163 | + - **Linux**: openGemini-studio-linux-amd64.tar.gz |
| 164 | + - **Windows**: openGemini-studio-windows-amd64.zip |
| 165 | + - **macOS**: openGemini-studio-darwin-universal.tar.gz |
| 166 | +
|
| 167 | + ## 📖 Installation |
| 168 | +
|
| 169 | + ### Linux |
| 170 | + ```bash |
| 171 | + tar -xzf openGemini-studio-linux-amd64.tar.gz |
| 172 | + chmod +x openGemini-studio |
| 173 | + ./openGemini-studio |
| 174 | + ``` |
| 175 | +
|
| 176 | + ### Windows |
| 177 | + Extract the zip file and run `openGemini-studio.exe` |
| 178 | +
|
| 179 | + ### macOS |
| 180 | + ```bash |
| 181 | + tar -xzf openGemini-studio-darwin-universal.tar.gz |
| 182 | + open openGemini-studio.app |
| 183 | + ``` |
| 184 | +
|
| 185 | + ⚠️ **Note**: This is a nightly build and may contain unstable features or bugs. |
| 186 | + EOF |
| 187 | + else |
| 188 | + cat << 'EOF' > release_body.md |
| 189 | + 🚀 **Release Build** |
| 190 | +
|
| 191 | + **Release Information:** |
| 192 | + - Version: ${{ steps.release_info.outputs.tag_name }} |
| 193 | + - Build Date: ${{ github.event.head_commit.timestamp }} |
| 194 | + - Commit: ${{ github.sha }} |
| 195 | +
|
| 196 | + ## 📦 Downloads |
| 197 | + - **Linux**: openGemini-studio-linux-amd64.tar.gz |
| 198 | + - **Windows**: openGemini-studio-windows-amd64.zip |
| 199 | + - **macOS**: openGemini-studio-darwin-universal.tar.gz |
| 200 | +
|
| 201 | + ## 📖 Installation |
| 202 | +
|
| 203 | + ### Linux |
| 204 | + ```bash |
| 205 | + tar -xzf openGemini-studio-linux-amd64.tar.gz |
| 206 | + chmod +x openGemini-studio |
| 207 | + ./openGemini-studio |
| 208 | + ``` |
| 209 | +
|
| 210 | + ### Windows |
| 211 | + Extract the zip file and run `openGemini-studio.exe` |
| 212 | +
|
| 213 | + ### macOS |
| 214 | + ```bash |
| 215 | + tar -xzf openGemini-studio-darwin-universal.tar.gz |
| 216 | + open openGemini-studio.app |
| 217 | + ``` |
| 218 | +
|
| 219 | + ## 📝 Changelog |
| 220 | + Please see the commit history for detailed changes. |
| 221 | + EOF |
| 222 | + fi |
| 223 | +
|
| 224 | + - name: Create/Update Release |
| 225 | + uses: softprops/action-gh-release@v2 |
| 226 | + with: |
| 227 | + tag_name: ${{ steps.release_info.outputs.tag_name }} |
| 228 | + name: ${{ steps.release_info.outputs.release_name }} |
| 229 | + body_path: release_body.md |
| 230 | + files: release-files/* |
| 231 | + prerelease: ${{ steps.release_info.outputs.prerelease }} |
| 232 | + draft: false |
0 commit comments