修改 workflow 使用容器运行 lint 和 build-web,分离 Docker 构建
This commit is contained in:
@@ -19,11 +19,10 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
name: Go Lint
|
name: Go Lint
|
||||||
runs-on: act-runner-4c6g
|
runs-on: act-runner-4c6g
|
||||||
|
container:
|
||||||
|
image: golang:1.22
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.22'
|
|
||||||
- name: Install golangci-lint
|
- name: Install golangci-lint
|
||||||
run: |
|
run: |
|
||||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.1
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.1
|
||||||
@@ -31,19 +30,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
$(go env GOPATH)/bin/golangci-lint run --timeout=5m ./server/...
|
$(go env GOPATH)/bin/golangci-lint run --timeout=5m ./server/...
|
||||||
|
|
||||||
build:
|
build-web:
|
||||||
name: Build Docker Image
|
name: Build Web
|
||||||
needs: lint
|
needs: lint
|
||||||
runs-on: act-runner
|
runs-on: act-runner-4c6g
|
||||||
|
container:
|
||||||
|
image: node:20
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
|
|
||||||
- name: Build web
|
- name: Build web
|
||||||
run: |
|
run: |
|
||||||
cd web
|
cd web
|
||||||
@@ -53,6 +49,26 @@ jobs:
|
|||||||
mkdir -p ../server/resource/build
|
mkdir -p ../server/resource/build
|
||||||
cp -r dist/* ../server/resource/build/
|
cp -r dist/* ../server/resource/build/
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: web-build
|
||||||
|
path: server/resource/build
|
||||||
|
|
||||||
|
build-docker:
|
||||||
|
name: Build Docker Image
|
||||||
|
needs: build-web
|
||||||
|
runs-on: act-runner-4c6g
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download build artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: web-build
|
||||||
|
path: server/resource/build
|
||||||
|
|
||||||
- name: Get version
|
- name: Get version
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user