All checks were successful
K5web Build / linux (1.17, 20) (push) Successful in 2m28s
135 lines
3.8 KiB
YAML
135 lines
3.8 KiB
YAML
name: K5web Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
linux:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node: [20]
|
|
go: ['1.17']
|
|
# dotnet: ['6.0.100']
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://gitea.cn/actions/checkout@v4
|
|
|
|
- id: tool-cache
|
|
uses: kongxiangyiren/gitea-tool-cache@v5
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
# Uncomment if needed
|
|
node-version: ${{ matrix.node }}
|
|
# dotnet-version: ${{ matrix.dotnet }}
|
|
|
|
- uses: https://gitea.cn/actions/setup-node@v4
|
|
with:
|
|
# gitea-tool-cache导出 node 具体版本
|
|
node-version: ${{ steps.tool-cache.outputs.node-version }}
|
|
- run: node -v & npm install --global yarn
|
|
|
|
- name: 缓存
|
|
uses: https://gitea.cn/actions/cache@v4
|
|
id: cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
- name: Install and Build frontend # 下载依赖 打包项目
|
|
run: |
|
|
# git clone --branch pages --depth 1 https://github.com/silenty4ng/k5web.git dist
|
|
git clone --depth 1 https://github.com/silenty4ng/k5web.git
|
|
cd k5web
|
|
# yarn config set registry https://registry.npmmirror.com
|
|
yarn install
|
|
yarn build
|
|
mv dist ../dist
|
|
|
|
- uses: https://gitea.cn/actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- run: go version
|
|
|
|
- name: Build for Windows amd64
|
|
run: |
|
|
export GOOS=windows
|
|
export GOARCH=amd64
|
|
export CGO_ENABLED=0
|
|
go build -ldflags="-s -w" -o k5web-windows-amd64.exe server.go
|
|
|
|
- name: Build for Linux amd64
|
|
run: |
|
|
export GOOS=linux
|
|
export GOARCH=amd64
|
|
export CGO_ENABLED=0
|
|
go build -ldflags="-s -w" -o k5web-linux-amd64 server.go
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: k5web-binaries
|
|
path: |
|
|
k5web-windows-amd64.exe
|
|
k5web-linux-amd64
|
|
retention-days: 7
|
|
chunk-size: 10485760 # 10 MB
|
|
|
|
# Uncomment the following steps as needed
|
|
|
|
# - name: Build for Windows arm64
|
|
# run: |
|
|
# export GOOS=windows
|
|
# export GOARCH=arm64
|
|
# export CC=aarch64-w64-mingw32-gcc
|
|
# export CGO_ENABLED=1
|
|
# go build -o memos-windows-arm64.exe ./bin/memos/main.go
|
|
|
|
# - name: Build for Linux amd64
|
|
# run: |
|
|
# export GOOS=linux
|
|
# export GOARCH=amd64
|
|
# export CGO_ENABLED=0
|
|
# go build -o memos-linux-amd64 ./bin/memos/main.go
|
|
|
|
# - name: Build for Linux arm64
|
|
# run: |
|
|
# export GOOS=linux
|
|
# export GOARCH=arm64
|
|
# export CC=aarch64-linux-gnu-gcc
|
|
# export CGO_ENABLED=1
|
|
# go build -o memos-linux-arm64 ./bin/memos/main.go
|
|
|
|
# - name: Build for macOS amd64
|
|
# run: |
|
|
# export GOOS=darwin
|
|
# export GOARCH=amd64
|
|
# export CGO_ENABLED=0
|
|
# go build -o memos-darwin-amd64 ./bin/memos/main.go
|
|
|
|
# - name: Build for macOS arm64
|
|
# run: |
|
|
# export GOOS=darwin
|
|
# export GOARCH=arm64
|
|
# export CGO_ENABLED=0
|
|
# go build -o memos-darwin-arm64 ./bin/memos/main.go
|
|
|
|
# - name: Upload artifacts
|
|
# uses: actions/upload-artifact@v3
|
|
# with:
|
|
# name: memos-binaries
|
|
# path: |
|
|
# memos/memos-windows-amd64.exe
|
|
# memos/memos-windows-arm64.exe
|
|
# memos/memos-linux-amd64
|
|
# memos/memos-linux-arm64
|
|
# memos/memos-darwin-amd64
|
|
# memos/memos-darwin-arm64
|
|
# retention-days: 7
|
|
# chunk-size: 10485760 # 10 MB
|