Build #350
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| platform: windows/amd64 | |
| slug: windows-amd64 | |
| artifact: uniTerm.exe | |
| - os: ubuntu-22.04 | |
| platform: linux/amd64 | |
| slug: linux-amd64 | |
| artifact: uniTerm | |
| - os: macos-latest | |
| platform: darwin/universal | |
| slug: darwin-universal | |
| artifact: uniTerm.app | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Wails CLI | |
| run: go install github.com/wailsapp/wails/v2/cmd/wails@latest | |
| - name: Set version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.ref_type }}" = "tag" ]; then | |
| echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | |
| else | |
| SHORT=$(echo "${{ github.sha }}" | cut -c1-7) | |
| echo "VERSION=dev-${SHORT}" >> $GITHUB_ENV | |
| fi | |
| - name: Install and build frontend | |
| env: | |
| VITE_VERSION: ${{ env.VERSION }} | |
| run: cd frontend && npm install && npm run build | |
| - name: Install Linux dependencies | |
| if: matrix.platform == 'linux/amd64' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev | |
| - name: Install NSIS (Windows) | |
| if: matrix.platform == 'windows/amd64' | |
| shell: bash | |
| run: | | |
| choco install nsis -y | |
| NSIS_BIN="/c/Program Files (x86)/NSIS/Bin" | |
| if [ ! -f "$NSIS_BIN/makensis.exe" ]; then echo "ERROR: makensis.exe not found at $NSIS_BIN"; exit 1; fi | |
| echo "makensis: $NSIS_BIN/makensis.exe" | |
| - name: Build | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.platform }}" = "windows/amd64" ]; then | |
| export PATH="/c/Program Files (x86)/NSIS/Bin:$PATH" | |
| fi | |
| echo "PATH=$PATH" | |
| wails build -platform ${{ matrix.platform }} -ldflags "-s -w -X main.Version=${{ env.VERSION }}" -skipbindings ${{ matrix.platform == 'windows/amd64' && '-nsis' || '' }} | |
| - name: Fix macOS permissions and sign | |
| if: matrix.platform == 'darwin/universal' | |
| run: | | |
| chmod +x build/bin/uniTerm.app/Contents/MacOS/uniTerm | |
| codesign --force --deep --sign - build/bin/uniTerm.app | |
| - name: Package (macOS) | |
| if: matrix.platform == 'darwin/universal' | |
| run: | | |
| cd build/bin | |
| mkdir -p dmg_staging | |
| cp -R uniTerm.app dmg_staging/ | |
| ln -s /Applications dmg_staging/Applications | |
| hdiutil create -volname uniTerm -srcfolder dmg_staging -ov -format UDZO ../../uniterm-darwin-universal-${VERSION}.dmg | |
| rm -rf dmg_staging | |
| - name: Package Windows portable | |
| if: matrix.platform == 'windows/amd64' | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path dist_tmp | Out-Null | |
| Copy-Item build/bin/uniTerm.exe dist_tmp/ | |
| $VERSION = "${{ env.VERSION }}" | |
| Push-Location dist_tmp | |
| Compress-Archive -Path uniTerm.exe -DestinationPath "../uniterm-windows-amd64-portable-${VERSION}.zip" -Force | |
| Pop-Location | |
| Remove-Item -Recurse -Force dist_tmp | |
| - name: Rename NSIS installer (Windows) | |
| if: matrix.platform == 'windows/amd64' | |
| shell: bash | |
| run: mv build/bin/uniTerm-amd64-installer.exe "uniterm-windows-amd64-installer-$VERSION.exe" | |
| - name: Package (Linux) | |
| if: matrix.platform == 'linux/amd64' | |
| run: | | |
| cd build/bin | |
| chmod +x uniTerm | |
| tar czf ../../uniterm-linux-amd64-${VERSION}.tar.gz uniTerm | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: uniTerm-${{ matrix.slug }} | |
| path: | | |
| uniterm-*.zip | |
| uniterm-*.tar.gz | |
| uniterm-*.exe | |
| uniterm-*.dmg | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Collect release files | |
| run: | | |
| find artifacts -type f \( -name '*.zip' -o -name '*.tar.gz' -o -name '*.exe' -o -name '*.dmg' \) -exec mv {} . \; | |
| ls -la uniterm-* | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| prerelease: true | |
| files: | | |
| uniterm-*.zip | |
| uniterm-*.tar.gz | |
| uniterm-*.exe | |
| uniterm-*.dmg | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |