github actions improvements, get go version from go.mod

pull/184/head
Simon Let 3 years ago
parent d498ec1995
commit 3d060d61f7
  1. 13
      .github/workflows/go.yaml
  2. 15
      .github/workflows/release.yaml
  3. 8
      .github/workflows/sh.yaml

@ -7,11 +7,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Go version
run: echo "GO_VERSION=$(grep 'go \d\.' go.mod | cut -d ' ' -f 2)" >> $GITHUB_ENV
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with:
- name: Check out code into the Go module directory go-version: ${{ env.GO_VERSION }}
uses: actions/checkout@v3
- name: Test - name: Test
run: go test -v ./... run: go test -v ./...

@ -12,15 +12,20 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout submodules - name: Get Go version
run: git submodule update --init --recursive run: echo "GO_VERSION=$(grep 'go \d\.' go.mod | cut -d ' ' -f 2)" >> $GITHUB_ENV
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v3
with: with:
go-version: 1.16 go-version: ${{ env.GO_VERSION }}
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2 uses: goreleaser/goreleaser-action@v2

@ -7,11 +7,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up - name: Set up
run: sudo apt-get install -y shellcheck zsh run: sudo apt-get install -y shellcheck zsh
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Test - name: Test
run: scripts/test.sh run: scripts/test.sh

Loading…
Cancel
Save