build: fix golang build cache

This commit is contained in:
wwqgtxx 2022-11-02 22:13:54 +08:00
parent 4e5bdec13a
commit c34c5ff1f9
3 changed files with 19 additions and 36 deletions

View file

@ -5,12 +5,14 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Go - name: Check out code into the Go module directory
uses: actions/setup-go@v1 uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with: with:
go-version: 1.18 go-version: '1.19'
- name: Check out code check-latest: true
uses: actions/checkout@v1 cache: true
- name: Build - name: Build
run: make all run: make all
- name: Release - name: Release

View file

@ -12,26 +12,15 @@ jobs:
Build: Build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Get latest go version
id: version
run: |
echo ::set-output name=go_version::$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g')
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ steps.version.outputs.go_version }}
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Cache go module - name: Setup Go
uses: actions/cache@v2 uses: actions/setup-go@v3
with: with:
path: ~/go/pkg/mod go-version: '1.19'
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} check-latest: true
restore-keys: | cache: true
${{ runner.os }}-go-
- name: Test - name: Test
if: ${{github.ref_name=='Beta'}} if: ${{github.ref_name=='Beta'}}

View file

@ -7,24 +7,16 @@ jobs:
Build: Build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Get latest go version
id: version
run: |
echo ::set-output name=go_version::$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g')
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.version.outputs.go_version }}
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Cache go module
uses: actions/cache@v2 - name: Setup Go
uses: actions/setup-go@v3
with: with:
path: ~/go/pkg/mod go-version: '1.19'
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} check-latest: true
restore-keys: | cache: true
${{ runner.os }}-go-
- name: Test - name: Test
run: | run: |
go test ./... go test ./...