fix download LuaJIT source code #309
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: [push] | |
jobs: | |
Build: | |
strategy: | |
matrix: | |
lua-version: [lua51, lua52, lua53, lua54, luajit] | |
os: [macos, ubuntu, windows] | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
id: go | |
- uses: msys2/setup-msys2@v2 | |
if: matrix.os == 'windows' | |
with: | |
update: true | |
msystem: MINGW64 | |
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-make make curl unzip | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Build Lua on Unix | |
if: matrix.os != 'windows' | |
run: | | |
cd golua/lua | |
./buildlua.sh | |
cd - | |
- name: Build GetNovel on Linux | |
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/ | |
- 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 | |
curl -sSL -o kindlegen.zip https://github.com/ystyle/kaf-cli/releases/download/kindlegen/KindleGen_Mac_64bit_v2_9.zip | |
unzip kindlegen.zip | |
mkdir ${{ matrix.os }}-amd64 | |
cp getnovel ${{ matrix.os }}-amd64/ | |
cp kindlegen ${{ matrix.os }}-amd64/ | |
cp -r pdfpresets ${{ matrix.os }}-amd64/ | |
cp -r handlers ${{ matrix.os }}-amd64/ | |
cp -r lua ${{ matrix.os }}-amd64/ | |
- name: Get LuaJIT | |
if: matrix.lua-version == 'luajit' && matrix.os == 'windows' | |
run: | | |
cd golua\lua | |
git clone --depth 1 https://github.com/LuaJIT/LuaJIT.git luajit | |
cd ..\.. | |
- name: Build Lua on Windows | |
if: matrix.os == 'windows' | |
shell: msys2 {0} | |
run: | | |
cd golua/lua/${{ matrix.lua-version }} | |
if [ "${{ matrix.lua-version }}" == "luajit" ]; then | |
env MSYSTEM=MINGW64 PATH=$PATH:/mingw64/bin make | |
mv src/*.a ./ | |
mv src/*.dll ../../../ | |
else | |
env MSYSTEM=MINGW64 PATH=$PATH:/mingw64/bin make mingw | |
fi | |
cd - | |
- 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 . | |
- name: copy files on Windows | |
if: matrix.os == 'windows' | |
shell: msys2 {0} | |
run: | | |
curl -sSL -o kindlegen.zip https://github.com/ystyle/kaf-cli/releases/download/kindlegen/kindlegen_win32_v2_9.zip | |
unzip kindlegen.zip | |
mkdir ${{ matrix.os }}-amd64 | |
cp *.exe ${{ matrix.os }}-amd64/ | |
cp *.dll ${{ matrix.os }}-amd64/ | |
cp -r pdfpresets ${{ matrix.os }}-amd64/ | |
cp -r handlers ${{ matrix.os }}-amd64/ | |
cp -r lua ${{ matrix.os }}-amd64/ | |
- name: Upload artifact getnovel-${{ matrix.os }}-amd64 | |
uses: actions/[email protected] | |
with: | |
name: getnovel-${{ matrix.os }}-${{ matrix.lua-version }} | |
path: ${{ matrix.os }}-amd64 | |
- name: Pack release | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: vimtor/[email protected] | |
with: | |
files: ${{ matrix.os }}-amd64/ | |
recursive: true | |
dest: getnovel-${{ matrix.os }}-${{ matrix.lua-version }}.zip | |
- name: upload Release | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GH_TOKEN }} | |
file: getnovel-${{ matrix.os }}-${{ matrix.lua-version }}.zip | |
asset_name: getnovel-${{ matrix.os }}-${{ matrix.lua-version }}.zip | |
tag: ${{ github.ref }} | |
overwrite: true |