Skip to content

Commit cbe4608

Browse files
committed
windows build: extract app version for FyneApp.toml
1 parent 9af6cee commit cbe4608

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

.github/workflows/build-windows.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,29 @@ jobs:
1111
- uses: actions/checkout@v6
1212

1313
- name: Set env
14+
id: version
1415
shell: bash
15-
run: if grep -Fxq "devel" version.txt;then echo "GO2TV_VERSION=$(cat version.txt)";else echo "GO2TV_VERSION=v$(cat version.txt)";fi >> $GITHUB_ENV
16+
run: |
17+
version="$(cat version.txt)"
18+
if [ "$version" = "devel" ]; then
19+
go2tv_version="$version"
20+
else
21+
go2tv_version="v$version"
22+
fi
23+
24+
windows_app_version="$(printf '%s\n' "$version" | sed -n 's/^\([0-9][0-9.]*\).*/\1/p')"
25+
if [ -z "$windows_app_version" ]; then
26+
windows_app_version="0.0.0"
27+
fi
28+
29+
{
30+
echo "GO2TV_VERSION=$go2tv_version"
31+
echo "GO2TV_WINDOWS_APP_VERSION=$windows_app_version"
32+
} >> "$GITHUB_ENV"
33+
{
34+
echo "go2tv_version=$go2tv_version"
35+
echo "windows_app_version=$windows_app_version"
36+
} >> "$GITHUB_OUTPUT"
1637
1738
- uses: actions/setup-go@v6
1839
with:
@@ -31,23 +52,23 @@ jobs:
3152
3253
- name: Update FyneApp.toml version
3354
shell: msys2 {0}
34-
run: sed -i "s/^Version.*/Version = \"$(echo ${{ env.GO2TV_VERSION }} | sed 's/^v//')\"/" cmd/go2tv/FyneApp.toml
55+
run: sed -i "s/^Version.*/Version = \"$GO2TV_WINDOWS_APP_VERSION\"/" cmd/go2tv/FyneApp.toml
3556

3657
- name: Package (Windows)
3758
shell: msys2 {0}
3859
run: |
3960
cd cmd/go2tv
40-
sed -i "s/version = \"dev\"/version = \"$(echo ${{ env.GO2TV_VERSION }} | sed 's/^v//')\"/" go2tv.go
61+
sed -i "s/version = \"dev\"/version = \"$(printf '%s\n' "$GO2TV_VERSION" | sed 's/^v//')\"/" go2tv.go
4162
CC_BIN="$(command -v x86_64-w64-mingw32-gcc-win32 || command -v gcc)"
4263
CXX_BIN="$(command -v x86_64-w64-mingw32-g++-win32 || command -v g++)"
43-
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 --os windows --icon ../../assets/go2tv-icon-desktop-256.png
64+
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
4465
objdump -p go2tv.exe | grep "DLL Name" | tee /tmp/go2tv-imports.txt
4566
! grep -Eq "libwinpthread-1.dll|libstdc\+\+-6.dll" /tmp/go2tv-imports.txt
4667
mv go2tv.exe ../../
4768
4869
- uses: actions/upload-artifact@v6
4970
with:
50-
name: go2tv_${{ env.GO2TV_VERSION }}_windows_amd64
71+
name: go2tv_${{ steps.version.outputs.go2tv_version }}_windows_amd64
5172
path: |
5273
LICENSE
5374
README.md

0 commit comments

Comments
 (0)