Update workflow files (#131)

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/131
This commit is contained in:
Jason Song 2023-04-19 17:46:52 +08:00
parent d4bebccc12
commit ed86e2f15a
3 changed files with 55 additions and 26 deletions

View File

@ -4,17 +4,34 @@ on:
push: push:
branches: [ main ] branches: [ main ]
env:
GOPATH: /go_path
GOCACHE: /go_cache
jobs: jobs:
goreleaser: goreleaser:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0 # all history for all branches and tags
- run: git fetch --force --tags
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: '>=1.20.1' go-version: '>=1.20.1'
- uses: https://gitea.com/actions/go-hashfiles@v0.0.1
id: hash-go
with:
patterns: |
go.mod
go.sum
- name: cache go
id: cache-go
uses: https://github.com/actions/cache@v3
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.hash-go.outputs.hash }}
- name: goreleaser - name: goreleaser
uses: https://github.com/goreleaser/goreleaser-action@v4 uses: https://github.com/goreleaser/goreleaser-action@v4
with: with:

View File

@ -5,17 +5,34 @@ on:
tags: tags:
- '*' - '*'
env:
GOPATH: /go_path
GOCACHE: /go_cache
jobs: jobs:
goreleaser: goreleaser:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0 # all history for all branches and tags
- run: git fetch --force --tags
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: '>=1.20.1' go-version: '>=1.20.1'
- uses: https://gitea.com/actions/go-hashfiles@v0.0.1
id: hash-go
with:
patterns: |
go.mod
go.sum
- name: cache go
id: cache-go
uses: https://github.com/actions/cache@v3
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.hash-go.outputs.hash }}
- name: Import GPG key - name: Import GPG key
id: import_gpg id: import_gpg
uses: https://github.com/crazy-max/ghaction-import-gpg@v5 uses: https://github.com/crazy-max/ghaction-import-gpg@v5

View File

@ -4,7 +4,6 @@ on:
- pull_request - pull_request
env: env:
GOPROXY: https://goproxy.io,direct
GOPATH: /go_path GOPATH: /go_path
GOCACHE: /go_cache GOCACHE: /go_cache
@ -13,28 +12,24 @@ jobs:
name: check and test name: check and test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: cache go path - uses: actions/checkout@v3
id: cache-go-path
uses: https://github.com/actions/cache@v3
with:
path: /go_path
key: go_path-${{ github.repository }}-${{ github.ref_name }}
restore-keys: |
go_path-${{ github.repository }}-
go_path-
- name: cache go cache
id: cache-go-cache
uses: https://github.com/actions/cache@v3
with:
path: /go_cache
key: go_cache-${{ github.repository }}-${{ github.ref_name }}
restore-keys: |
go_cache-${{ github.repository }}-
go_cache-
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: 1.20 go-version: '>=1.20.1'
- uses: actions/checkout@v3 - uses: https://gitea.com/actions/go-hashfiles@v0.0.1
id: hash-go
with:
patterns: |
go.mod
go.sum
- name: cache go
id: cache-go
uses: https://github.com/actions/cache@v3
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.hash-go.outputs.hash }}
- name: vet checks - name: vet checks
run: make vet run: make vet
- name: build - name: build