Skip to content

Commit

Permalink
unified steps
Browse files Browse the repository at this point in the history
  • Loading branch information
missdeer committed Jan 18, 2024
1 parent f821f4e commit f57fc56
Showing 1 changed file with 23 additions and 32 deletions.
55 changes: 23 additions & 32 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ jobs:
strategy:
matrix:
lua-version: [lua51, lua52, lua53, lua54]
os: [macos, ubuntu, windows]
include:
- os: ubuntu
shell: bash
executable: getnovel
- os: macos
shell: bash
executable: getnovel
- os: windows
shell: "msys {0}"
executable: getnovel.exe

runs-on: ${{ matrix.os }}-latest
steps:
- name: Set up Go
Expand All @@ -24,56 +34,37 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Build Lua on Unix
if: matrix.os != 'windows'
- name: Build Lua
shell: ${{ matrix.shell }}
run: |
cd golua/lua
./buildlua.sh
env MSYSTEM=MINGW64 PATH=$PATH:/mingw64/bin ./buildlua.sh
cd -
- name: Build on Unix
if: matrix.os != 'macos' && matrix.os != 'windows'
- name: Build GetNovel on Unix
if: matrix.os == 'ubuntu'
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/
go build -ldflags="-s -w" -tags ${{ matrix.lua-version }} -o ${{ matrix.executable }} .
- name: Build on macOS
- name: Build GetNovel 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}
run: |
cd golua/lua/${{ matrix.lua-version }}
env MSYSTEM=MINGW64 PATH=$PATH:/mingw64/bin make mingw
cd -
lipo -create -output ${{ matrix.executable }} getnovel-amd64 getnovel-arm64
- name: Build GetNovel on Windows
if: matrix.os == 'windows'
shell: cmd
run: |
set PATH=D:\a\_temp\msys64\mingw64\bin;%PATH%
go build -ldflags="-s -w" -tags ${{ matrix.lua-version }} -o getnovel.exe .
go build -ldflags="-s -w" -tags ${{ matrix.lua-version }} -o ${{ matrix.executable }} .
- name: copy files on Windows
if: matrix.os == 'windows'
shell: msys2 {0}
- name: copy files
shell: ${{ matrix.shell }}
run: |
mkdir ${{ matrix.os }}-amd64
cp getnovel.exe ${{ matrix.os }}-amd64/
cp ${{ matrix.executable }} ${{ matrix.os }}-amd64/
cp -r pdfpresets ${{ matrix.os }}-amd64/
cp -r handlers ${{ matrix.os }}-amd64/
cp -r lua ${{ matrix.os }}-amd64/
Expand Down

0 comments on commit f57fc56

Please sign in to comment.