ci: 添加Go模块缓存和Docker构建缓存
This commit is contained in:
@@ -10,6 +10,9 @@ on:
|
|||||||
- master
|
- master
|
||||||
- dev
|
- dev
|
||||||
|
|
||||||
|
env:
|
||||||
|
GO_VERSION: '1.25'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -20,8 +23,15 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: ${{ env.GO_VERSION }}
|
||||||
cache: false
|
cache: true
|
||||||
|
|
||||||
|
- name: Go cache info
|
||||||
|
run: |
|
||||||
|
echo "Go cache directory:"
|
||||||
|
go env GOCACHE
|
||||||
|
echo "Go module cache directory:"
|
||||||
|
go env GOMODCACHE
|
||||||
|
|
||||||
- name: Install build tools
|
- name: Install build tools
|
||||||
run: sudo apt-get update && sudo apt-get install -y gcc
|
run: sudo apt-get update && sudo apt-get install -y gcc
|
||||||
@@ -76,3 +86,5 @@ jobs:
|
|||||||
code.littlelan.cn/carrot_bbs/backend:latest
|
code.littlelan.cn/carrot_bbs/backend:latest
|
||||||
code.littlelan.cn/carrot_bbs/backend:${{ github.sha }}
|
code.littlelan.cn/carrot_bbs/backend:${{ github.sha }}
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
Reference in New Issue
Block a user