57 lines
1.4 KiB
YAML
57 lines
1.4 KiB
YAML
name: Build Docker Image Artifact
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: '镜像标签版本'
|
|
required: true
|
|
default: 'latest'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Docker Image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Build web
|
|
run: |
|
|
cd web
|
|
npm install --global yarn
|
|
yarn
|
|
yarn build
|
|
cp -r build ../server/resource/
|
|
|
|
- name: Build binary
|
|
run: |
|
|
cd server
|
|
go mod tidy
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags '-s -w' -o next-terminal ../main.go
|
|
|
|
- name: Create package
|
|
run: |
|
|
mkdir -p next-terminal
|
|
cp server/next-terminal next-terminal/
|
|
cp config.yml.example next-terminal/config.yml
|
|
cp LICENSE next-terminal/
|
|
tar zcvf next-terminal-${{ inputs.tag }}-linux-amd64.tar.gz next-terminal/
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: next-terminal-${{ inputs.tag }}-linux-amd64
|
|
path: next-terminal-${{ inputs.tag }}-linux-amd64.tar.gz
|
|
retention-days: 7
|