Skip to content

Commit

Permalink
Clean up actions and add windows release builds
Browse files Browse the repository at this point in the history
* Fix build scripts

* Update workflow

* Update workflow versions

* Fix build architectures

* Add cxx and ldflags

* Fix cc target

* Add zlib package

* Add correct zlib package

* Fix gitignore

* Fix script formatting

* Rearrange action

<rikaitan.link>ZmU2MDhhYjM1YTgzZTNmZTNlYzAyOWZjNmM0MTFmNmNlN2UwYjA5NQo=</rikaitan.link>
  • Loading branch information
Kuuuube committed Jun 13, 2024
1 parent b389f89 commit 3b58173
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,46 @@ 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
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
rikaitan-import-linux.zip
rikaitan-import-windows.zip
draft: true
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
15 changes: 5 additions & 10 deletions scripts/build_linux.sh
Original file line number Diff line number Diff line change
@@ -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"
17 changes: 5 additions & 12 deletions scripts/build_windows.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 3b58173

Please sign in to comment.