github: create new action to hold common setup

This commit is contained in:
yyforyongyu
2022-12-15 16:23:13 +08:00
parent 601cf60070
commit 26613a2d46
2 changed files with 61 additions and 154 deletions

28
.github/actions/setup-go/action.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
# A resuable workflow that's used to setup the go enviroment and cache.
name: Setup go enviroment
runs:
using: "composite"
steps:
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
- name: go cache
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-