diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index 8c56c22..af48aa2 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -9,48 +9,36 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + env: GOFLAGS: -mod=readonly GOPROXY: https://proxy.golang.org jobs: - matrix: - name: Matrix + lint: runs-on: ubuntu-latest - outputs: - gomod: ${{ steps.gomod.outputs.matrix }} - steps: - - uses: actions/checkout@v3 - - id: gomod - run: | - matrix=$(find . -type f -name "go.mod" -print0 | xargs -0 -n1 dirname | sort --unique | jq -R -s -c 'split("\n")[:-1]') - echo "${matrix}" - echo "::set-output name=matrix::${matrix}" - check: - name: Check - needs: matrix - runs-on: ubuntu-latest - strategy: - matrix: - gomod: ${{ fromJson(needs.matrix.outputs.gomod) }} - env: - GOFLAGS: -mod=readonly - GOPROXY: https://proxy.golang.org steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: + cache: true + check-latest: true go-version-file: 'go.mod' + - uses: golangci/golangci-lint-action@v3 - uses: golangci/golangci-lint-action@v3 with: - working-directory: ${{ matrix.gomod }} + working-directory: example test: - name: Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: + cache: true + check-latest: true go-version-file: 'go.mod' - run: go test -v ./... diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml new file mode 100644 index 0000000..9f72302 --- /dev/null +++ b/.github/workflows/releases.yml @@ -0,0 +1,31 @@ +name: Releases + +on: + push: + tags: + - v*.*.* + workflow_dispatch: + +env: + GOFLAGS: -mod=readonly + GOPROXY: https://proxy.golang.org + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + cache: true + check-latest: true + go-version-file: 'go.mod' + - uses: goreleaser/goreleaser-action@v4 + with: + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..2bb7412 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,2 @@ +builds: + - skip: true