|
| 1 | +name: Build All Platforms |
| 2 | + |
| 3 | +# Trigger: solo cuando se crea un tag de versión |
| 4 | +on: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + GO_VERSION: '1.21' |
| 12 | + NODE_VERSION: '20' |
| 13 | + |
| 14 | +jobs: |
| 15 | + # Job para Windows |
| 16 | + build-windows: |
| 17 | + name: Build Windows |
| 18 | + runs-on: windows-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + submodules: recursive |
| 25 | + |
| 26 | + - name: Setup Go |
| 27 | + uses: actions/setup-go@v5 |
| 28 | + with: |
| 29 | + go-version: ${{ env.GO_VERSION }} |
| 30 | + cache: true |
| 31 | + cache-dependency-path: go.sum |
| 32 | + |
| 33 | + - name: Setup pnpm |
| 34 | + uses: pnpm/action-setup@v4 |
| 35 | + with: |
| 36 | + version: 10 |
| 37 | + |
| 38 | + - name: Setup Node.js |
| 39 | + uses: actions/setup-node@v4 |
| 40 | + with: |
| 41 | + node-version: ${{ env.NODE_VERSION }} |
| 42 | + cache: 'pnpm' |
| 43 | + cache-dependency-path: frontend/pnpm-lock.yaml |
| 44 | + |
| 45 | + - name: Install frontend dependencies |
| 46 | + working-directory: ./frontend |
| 47 | + run: pnpm install --frozen-lockfile |
| 48 | + |
| 49 | + - name: Build frontend |
| 50 | + working-directory: ./frontend |
| 51 | + run: pnpm build |
| 52 | + |
| 53 | + - name: Install Wails |
| 54 | + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest |
| 55 | + |
| 56 | + - name: Build Wails application |
| 57 | + run: wails build -platform windows/amd64 |
| 58 | + |
| 59 | + - name: Rename artifact |
| 60 | + shell: bash |
| 61 | + run: | |
| 62 | + mv build/bin/Sendlog-Syslog.exe build/bin/Sendlog-Syslog-windows-amd64.exe |
| 63 | +
|
| 64 | + - name: Upload artifact |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: windows-build |
| 68 | + path: build/bin/Sendlog-Syslog-windows-amd64.exe |
| 69 | + retention-days: 1 |
| 70 | + |
| 71 | + # Job para Linux |
| 72 | + build-linux: |
| 73 | + name: Build Linux |
| 74 | + runs-on: ubuntu-latest |
| 75 | + |
| 76 | + steps: |
| 77 | + - name: Checkout code |
| 78 | + uses: actions/checkout@v4 |
| 79 | + with: |
| 80 | + submodules: recursive |
| 81 | + |
| 82 | + - name: Install Linux dependencies |
| 83 | + run: | |
| 84 | + sudo apt-get update |
| 85 | + sudo apt-get install -y \ |
| 86 | + libgtk-3-dev \ |
| 87 | + libwebkit2gtk-4.0-dev \ |
| 88 | + build-essential \ |
| 89 | + pkg-config \ |
| 90 | + libappindicator3-dev |
| 91 | +
|
| 92 | + - name: Setup Go |
| 93 | + uses: actions/setup-go@v5 |
| 94 | + with: |
| 95 | + go-version: ${{ env.GO_VERSION }} |
| 96 | + cache: true |
| 97 | + cache-dependency-path: go.sum |
| 98 | + |
| 99 | + - name: Setup pnpm |
| 100 | + uses: pnpm/action-setup@v4 |
| 101 | + with: |
| 102 | + version: 10 |
| 103 | + |
| 104 | + - name: Setup Node.js |
| 105 | + uses: actions/setup-node@v4 |
| 106 | + with: |
| 107 | + node-version: ${{ env.NODE_VERSION }} |
| 108 | + cache: 'pnpm' |
| 109 | + cache-dependency-path: frontend/pnpm-lock.yaml |
| 110 | + |
| 111 | + - name: Install frontend dependencies |
| 112 | + working-directory: ./frontend |
| 113 | + run: pnpm install --frozen-lockfile |
| 114 | + |
| 115 | + - name: Build frontend |
| 116 | + working-directory: ./frontend |
| 117 | + run: pnpm build |
| 118 | + |
| 119 | + - name: Install Wails |
| 120 | + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest |
| 121 | + |
| 122 | + - name: Build Wails application |
| 123 | + run: wails build -platform linux/amd64 |
| 124 | + |
| 125 | + - name: Rename artifact |
| 126 | + run: | |
| 127 | + mv build/bin/Sendlog-Syslog build/bin/Sendlog-Syslog-linux-amd64 |
| 128 | +
|
| 129 | + - name: Upload artifact |
| 130 | + uses: actions/upload-artifact@v4 |
| 131 | + with: |
| 132 | + name: linux-build |
| 133 | + path: build/bin/Sendlog-Syslog-linux-amd64 |
| 134 | + retention-days: 1 |
| 135 | + |
| 136 | + # Job para crear el release con todos los binarios |
| 137 | + create-release: |
| 138 | + name: Create Release |
| 139 | + needs: [build-windows, build-linux] |
| 140 | + runs-on: ubuntu-latest |
| 141 | + if: startsWith(github.ref, 'refs/tags/v') |
| 142 | + |
| 143 | + steps: |
| 144 | + - name: Checkout code |
| 145 | + uses: actions/checkout@v4 |
| 146 | + |
| 147 | + - name: Download Windows artifact |
| 148 | + uses: actions/download-artifact@v4 |
| 149 | + with: |
| 150 | + name: windows-build |
| 151 | + path: ./release |
| 152 | + |
| 153 | + - name: Download Linux artifact |
| 154 | + uses: actions/download-artifact@v4 |
| 155 | + with: |
| 156 | + name: linux-build |
| 157 | + path: ./release |
| 158 | + |
| 159 | + - name: List release files |
| 160 | + run: ls -la ./release |
| 161 | + |
| 162 | + - name: Extract version from tag |
| 163 | + id: version |
| 164 | + run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT |
| 165 | + |
| 166 | + - name: Create GitHub Release |
| 167 | + uses: softprops/action-gh-release@v1 |
| 168 | + with: |
| 169 | + name: SendLog Syslog ${{ steps.version.outputs.version }} |
| 170 | + body: | |
| 171 | + ## SendLog Syslog ${{ steps.version.outputs.version }} |
| 172 | + |
| 173 | + ### Downloads |
| 174 | + - **Windows**: `Sendlog-Syslog-windows-amd64.exe` |
| 175 | + - **Linux**: `Sendlog-Syslog-linux-amd64` |
| 176 | + |
| 177 | + ### Linux Installation |
| 178 | + ```bash |
| 179 | + chmod +x Sendlog-Syslog-linux-amd64 |
| 180 | + ./Sendlog-Syslog-linux-amd64 |
| 181 | + ``` |
| 182 | + |
| 183 | + ### Requirements |
| 184 | + - **Linux**: GTK3 and WebKitGTK runtime libraries |
| 185 | + ```bash |
| 186 | + sudo apt install libgtk-3-0 libwebkit2gtk-4.0-37 |
| 187 | + ``` |
| 188 | + files: | |
| 189 | + ./release/Sendlog-Syslog-windows-amd64.exe |
| 190 | + ./release/Sendlog-Syslog-linux-amd64 |
| 191 | + draft: false |
| 192 | + prerelease: false |
| 193 | + env: |
| 194 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments