Skip to content

Commit

Permalink
build fat binary on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
missdeer committed Jan 18, 2024
1 parent 6ccf776 commit 231b557
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,29 @@ jobs:
cd golua/lua
./buildlua.sh
cd -
- name: Build on Unix
if: matrix.os != 'macos' && matrix.os != 'windows'
run: |
go build -ldflags="-s -w" -tags ${{ matrix.lua-version }} -o getnovel .
mkdir ${{ matrix.os }}-amd64
cp getnovel ${{ matrix.os }}-amd64/
cp -r pdfpresets ${{ matrix.os }}-amd64/
cp -r handlers ${{ matrix.os }}-amd64/
cp -r lua ${{ matrix.os }}-amd64/
- name: Build on macOS
if: matrix.os == 'macos'
run: |
env CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -tags ${{ matrix.lua-version }} -o getnovel-amd64 .
env CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -tags ${{ matrix.lua-version }} -o getnovel-arm64 .
lipo -create -output getnovel getnovel-amd64 getnovel-arm64
mkdir ${{ matrix.os }}-amd64
cp getnovel ${{ matrix.os }}-amd64/
cp -r pdfpresets ${{ matrix.os }}-amd64/
cp -r handlers ${{ matrix.os }}-amd64/
cp -r lua ${{ matrix.os }}-amd64/
- name: Build Lua on Windows
if: matrix.os == 'windows'
shell: msys2 {0}
Expand Down Expand Up @@ -65,14 +81,15 @@ jobs:
- name: Upload artifact getnovel-${{ matrix.os }}-amd64
uses: actions/[email protected]
with:
name: getnovel-${{ matrix.os }}-amd64-${{ matrix.lua-version }}
name: getnovel-${{ matrix.os }}-${{ matrix.lua-version }}
path: ${{ matrix.os }}-amd64

- name: upload getnovel Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GH_TOKEN }}
file: ${{ matrix.os }}-amd64
asset_name: getnovel-${{ matrix.os }}-amd64-${{ matrix.lua-version }}
asset_name: getnovel-${{ matrix.os }}-${{ matrix.lua-version }}
tag: ${{ github.ref }}
release_name: ${{ github.ref_name }}
overwrite: true

0 comments on commit 231b557

Please sign in to comment.