diff --git a/.github/workflows/build-and-release.yaml b/.github/workflows/build-and-release.yaml index 7d501a3..6c2b3c4 100644 --- a/.github/workflows/build-and-release.yaml +++ b/.github/workflows/build-and-release.yaml @@ -10,33 +10,38 @@ jobs: uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: 1.21.0 id: go + - name: Set up MinGW + uses: egor-tensin/setup-mingw@v2 + - name: Install Packages run: | sudo apt-get install libgtk-3-dev -y + sudo apt-get install libz-mingw-w64-dev - name: Build for Linux run: | - # Create build directory - build_dir="rikaitan-import-linux" - mkdir -p "$build_dir" + ./scripts/build_linux.sh - # Build - go build -o "$build_dir" ./rikaitan - go build -o "$build_dir" ./rikaitan-gtk + - name: Upload Linux Artifact + uses: actions/upload-artifact@v4 + with: + path: rikaitan-import-linux + name: rikaitan-import-linux - # Zip the build directory - zip -r "$build_dir.zip" "$build_dir" + - name: Build for Windows + run: | + ./scripts/build_windows.sh - - name: Upload Release Artifacts - uses: actions/upload-artifact@v3 + - name: Upload Windows Artifact + uses: actions/upload-artifact@v4 with: - path: rikaitan-import-linux.zip - name: rikaitan-import-linux + path: rikaitan-import-windows + name: rikaitan-import-windows - name: Release on Tag Creation uses: softprops/action-gh-release@v1 @@ -44,6 +49,7 @@ jobs: with: files: | rikaitan-import-linux.zip + rikaitan-import-windows.zip draft: true generate_release_notes: true token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 7647860..9d3c588 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ yomichan-gtk/yomichan-gtk* yomichan/yomichan* build + +rikaitan-import-linux +rikaitan-import-windows + +rikaitan-import-linux.zip +rikaitan-import-windows.zip \ No newline at end of file diff --git a/scripts/build_linux.sh b/scripts/build_linux.sh index a568012..43d9f3a 100755 --- a/scripts/build_linux.sh +++ b/scripts/build_linux.sh @@ -1,14 +1,9 @@ #!/bin/bash -mkdir -p dst -mkdir -p rikaitan-import +build_dir="rikaitan-import-linux" +mkdir -p "$build_dir" -go build github.com/Ajatt-Tools/rikaitan-import/tree/master/yomichan -go build github.com/Ajatt-Tools/rikaitan-import/tree/master/yomichan-gtk +go build -o "rikaitan-import-linux" ./rikaitan +go build -o "rikaitan-import-linux" ./rikaitan-gtk -mv rikaitan rikaitan-import -mv rikaitan-gtk rikaitan-import - -tar czvf dst/rikaitan-import_linux.tar.gz rikaitan-import - -rm -rf rikaitan-import +zip -r "$build_dir.zip" "$build_dir" diff --git a/scripts/build_windows.sh b/scripts/build_windows.sh index 0d856b8..ec8c433 100755 --- a/scripts/build_windows.sh +++ b/scripts/build_windows.sh @@ -1,16 +1,9 @@ #!/bin/bash -mkdir -p dst -mkdir -p yomichan-import +build_dir="rikaitan-import-windows" +mkdir -p "$build_dir" -export CXX=x86_64-w64-mingw32-g++.exe -export CC=x86_64-w64-mingw32-gcc.exe -go build foosoft.net/projects/yomichan-import/yomichan -go build -ldflags="-H windowsgui" foosoft.net/projects/yomichan-import/yomichan-gtk +CGO_ENABLED=1 CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ GOOS=windows OARCH=amd64 go build -o "rikaitan-import-windows" -ldflags '-extldflags "-static"' ./rikaitan +CGO_ENABLED=1 CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ GOOS=windows OARCH=amd64 go build -o "rikaitan-import-windows" -ldflags '-extldflags "-static"' ./rikaitan-gtk -mv yomichan.exe yomichan-import -mv yomichan-gtk.exe yomichan-import - -7za a yomichan-import_windows.zip yomichan-import - -rm -rf yomichan-import +zip -r "$build_dir.zip" "$build_dir"