From ed86e2f15a0d05401eb9e895d41b7e4e359c91c4 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Wed, 19 Apr 2023 17:46:52 +0800 Subject: [PATCH] Update workflow files (#131) Reviewed-on: https://gitea.com/gitea/act_runner/pulls/131 --- .gitea/workflows/release-nightly.yml | 21 +++++++++++++-- .gitea/workflows/release-tag.yml | 21 +++++++++++++-- .gitea/workflows/test.yml | 39 ++++++++++++---------------- 3 files changed, 55 insertions(+), 26 deletions(-) diff --git a/.gitea/workflows/release-nightly.yml b/.gitea/workflows/release-nightly.yml index 9304808..92e878c 100644 --- a/.gitea/workflows/release-nightly.yml +++ b/.gitea/workflows/release-nightly.yml @@ -4,17 +4,34 @@ on: push: branches: [ main ] +env: + GOPATH: /go_path + GOCACHE: /go_cache + jobs: goreleaser: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 - - run: git fetch --force --tags + fetch-depth: 0 # all history for all branches and tags - uses: actions/setup-go@v3 with: 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 uses: https://github.com/goreleaser/goreleaser-action@v4 with: diff --git a/.gitea/workflows/release-tag.yml b/.gitea/workflows/release-tag.yml index 4ae629b..e3c3d18 100644 --- a/.gitea/workflows/release-tag.yml +++ b/.gitea/workflows/release-tag.yml @@ -5,17 +5,34 @@ on: tags: - '*' +env: + GOPATH: /go_path + GOCACHE: /go_cache + jobs: goreleaser: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 - - run: git fetch --force --tags + fetch-depth: 0 # all history for all branches and tags - uses: actions/setup-go@v3 with: 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 id: import_gpg uses: https://github.com/crazy-max/ghaction-import-gpg@v5 diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 372f61a..ef7824c 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -4,7 +4,6 @@ on: - pull_request env: - GOPROXY: https://goproxy.io,direct GOPATH: /go_path GOCACHE: /go_cache @@ -13,31 +12,27 @@ jobs: name: check and test runs-on: ubuntu-latest steps: - - name: cache go path - 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/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: 1.20 - - uses: actions/checkout@v3 + 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: vet checks run: make vet - name: build run: make build - name: test - run: make test \ No newline at end of file + run: make test