From 6bc19cbc331a1c33034984a5ac85a843f611f1f5 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 14 Mar 2024 13:27:47 +0000 Subject: [PATCH] Improve workflows (#516) Starting from setup-go v4, it will cache build dependencies by default, see https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs. Also bump some versions. Reviewed-on: https://gitea.com/gitea/act_runner/pulls/516 Reviewed-by: silverwind Reviewed-by: Lunny Xiao Co-authored-by: Jason Song Co-committed-by: Jason Song --- .gitea/workflows/release-nightly.yml | 28 +++++--------------------- .gitea/workflows/release-tag.yml | 30 ++++++---------------------- .gitea/workflows/test.yml | 22 ++------------------ 3 files changed, 13 insertions(+), 67 deletions(-) diff --git a/.gitea/workflows/release-nightly.yml b/.gitea/workflows/release-nightly.yml index c85d4f4..b115d8f 100644 --- a/.gitea/workflows/release-nightly.yml +++ b/.gitea/workflows/release-nightly.yml @@ -4,36 +4,18 @@ on: push: branches: [ main ] -env: - GOPATH: /go_path - GOCACHE: /go_cache - jobs: goreleaser: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # all history for all branches and tags - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: '>=1.21.0' - - 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 }} + go-version-file: 'go.mod' - name: goreleaser - uses: https://github.com/goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser-pro version: latest @@ -54,7 +36,7 @@ jobs: DOCKER_LATEST: nightly steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # all history for all branches and tags diff --git a/.gitea/workflows/release-tag.yml b/.gitea/workflows/release-tag.yml index f26561e..0a09ced 100644 --- a/.gitea/workflows/release-tag.yml +++ b/.gitea/workflows/release-tag.yml @@ -5,43 +5,25 @@ on: tags: - '*' -env: - GOPATH: /go_path - GOCACHE: /go_cache - jobs: goreleaser: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # all history for all branches and tags - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: '>=1.21.0' - - 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 }} + go-version-file: 'go.mod' - name: Import GPG key id: import_gpg - uses: https://github.com/crazy-max/ghaction-import-gpg@v5 + uses: crazy-max/ghaction-import-gpg@v6 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} passphrase: ${{ secrets.PASSPHRASE }} fingerprint: CC64B1DB67ABBEECAB24B6455FC346329753F4B0 - name: goreleaser - uses: https://github.com/goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser-pro version: latest @@ -65,7 +47,7 @@ jobs: DOCKER_LATEST: latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # all history for all branches and tags diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 7d1298f..1a15bd9 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -3,33 +3,15 @@ on: - push - pull_request -env: - GOPATH: /go_path - GOCACHE: /go_cache - jobs: lint: name: check and test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: '>=1.21.0' - - 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 }} + go-version-file: 'go.mod' - name: vet checks run: make vet - name: build