forked from ystyle/kaf-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 3.18 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Go
on:
release:
types: [published]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.21
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
curl -OL https://github.com/ystyle/kaf-cli/releases/download/kindlegen/KindleGen_Mac_64bit_v2_9.zip
curl -OL https://github.com/ystyle/kaf-cli/releases/download/kindlegen/kindlegen_win32_v2_9.zip
unzip -d darwin KindleGen_Mac_64bit_v2_9.zip
unzip -d windows kindlegen_win32_v2_9.zip
- name: Build
run: |
hash=`git rev-list --tags --max-count=1`
version=`git describe --tags $hash`
flag="-s -w -X main.secret=${{ secrets.API_SECRET }} -X main.measurement=${{ secrets.MEASUREMENT }} -X main.version=$version"
mkdir -p /home/runner/go_bin
export GOBIN=/home/runner/go_bin
go get github.com/akavel/rsrc
go install github.com/akavel/rsrc
go mod tidy
GOOS=linux GOARCH=amd64 go build -ldflags "$flag" -o build/linux-amd64/kaf-cli cmd/cli.go
GOOS=linux GOARCH=arm64 go build -ldflags "$flag" -o build/linux-arm64/kaf-cli cmd/cli.go
GOOS=linux GOARCH=loong64 go build -ldflags "$flag" -o build/linux-loong64/kaf-cli cmd/cli.go
GOOS=darwin GOARCH=amd64 go build -ldflags "$flag" -o build/darwin-amd64/kaf-cli cmd/cli.go
GOOS=darwin GOARCH=arm64 go build -ldflags "$flag" -o build/darwin-arm64/kaf-cli cmd/cli.go
GOOS=wasip1 GOARCH=wasm go build -ldflags "$flag" -o build/wasm-wasip1/kaf-cli.wasm cmd/cli.go
${GOBIN}/rsrc -arch amd64 -manifest kaf-cli.exe.manifest -ico ./assets/kaf.ico -o kaf-cli.syso
GOOS=windows GOARCH=386 go build -ldflags "$flag" -o build/windows-386/kaf-cli.exe cmd/cli.go
GOOS=windows GOARCH=amd64 go build -ldflags "$flag" -o build/windows-amd64/kaf-cli.exe cmd/cli.go
- name: compression zip
run: |
hash=`git rev-list --tags --max-count=1`
version=`git describe --tags $hash`
zip -j kaf-cli_${version}_windows_amd64.zip build/windows-amd64/kaf-cli.exe windows/kindlegen.exe 注册右键菜单.ps1
zip -j kaf-cli_${version}_windows_386.zip build/windows-386/kaf-cli.exe windows/kindlegen.exe
zip -j kaf-cli_${version}_darwin_amd64.zip build/darwin-amd64/kaf-cli darwin/kindlegen
zip -j kaf-cli_${version}_darwin_arm64.zip build/darwin-arm64/kaf-cli darwin/kindlegen
zip -j kaf-cli_${version}_linux_amd64.zip build/linux-amd64/kaf-cli
zip -j kaf-cli_${version}_linux_arm64.zip build/linux-arm64/kaf-cli
zip -j kaf-cli_${version}_linux_loong64.zip build/linux-loong64/kaf-cli
zip -j kaf-cli_${version}_wasm_wasip1.zip build/wasm-wasip1/kaf-cli README_wasi.md
- name: Upload release binaries
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["./kaf-cli_*.zip"]'