update codebase #859
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 for Windows | |
| on: [push] | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set env | |
| id: version | |
| shell: bash | |
| run: | | |
| version="$(cat version.txt)" | |
| if [ "$version" = "devel" ]; then | |
| go2tv_version="$version" | |
| else | |
| go2tv_version="v$version" | |
| fi | |
| if [[ "$version" =~ ^([0-9]+([.][0-9]+)*) ]]; then | |
| windows_app_version="${BASH_REMATCH[1]}" | |
| else | |
| windows_app_version="0.0.0" | |
| fi | |
| { | |
| echo "GO2TV_VERSION=$go2tv_version" | |
| echo "GO2TV_WINDOWS_APP_VERSION=$windows_app_version" | |
| } >> "$GITHUB_ENV" | |
| { | |
| echo "go2tv_version=$go2tv_version" | |
| echo "windows_app_version=$windows_app_version" | |
| } >> "$GITHUB_OUTPUT" | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Setup MSYS2 | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| path-type: inherit | |
| update: true | |
| install: >- | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-cppwinrt | |
| mingw-w64-x86_64-pkg-config | |
| - name: Package (Windows) | |
| shell: msys2 {0} | |
| run: | | |
| cd cmd/go2tv | |
| CC_BIN="$(command -v x86_64-w64-mingw32-gcc-win32 || command -v gcc)" | |
| CXX_BIN="$(command -v x86_64-w64-mingw32-g++-win32 || command -v g++)" | |
| CGO_ENABLED=1 CC="$CC_BIN" CXX="$CXX_BIN" CGO_LDFLAGS="-static -static-libgcc -static-libstdc++ -Wl,-Bstatic -l:libstdc++.a -l:libwinpthread.a" GOFLAGS="-ldflags=-linkmode=external -ldflags=-extldflags=-static" go run github.com/alexballas/refyne/v2/cmd/fyne@latest package --release --app-id app.go2tv.go2tv --app-version "$GO2TV_WINDOWS_APP_VERSION" --os windows --icon ../../assets/go2tv-icon-desktop-256.png | |
| objdump -p go2tv.exe | grep "DLL Name" | tee /tmp/go2tv-imports.txt | |
| ! grep -Eq "libwinpthread-1.dll|libstdc\+\+-6.dll" /tmp/go2tv-imports.txt | |
| mv go2tv.exe ../../ | |
| - name: Build lite (Windows) | |
| shell: bash | |
| run: | | |
| CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build \ | |
| -trimpath -ldflags "-s -w" \ | |
| -o go2tv-lite.exe ./cmd/go2tv-lite | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: go2tv_${{ steps.version.outputs.go2tv_version }}_windows_amd64 | |
| path: | | |
| LICENSE | |
| README.md | |
| go2tv.exe | |
| retention-days: 2 | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: go2tv_${{ steps.version.outputs.go2tv_version }}_windows_amd64_lite | |
| path: | | |
| LICENSE | |
| README.md | |
| go2tv-lite.exe | |
| retention-days: 2 |