Merge pull request #173 from foomo/feature/update-workflows

chore: add release workflow
This commit is contained in:
Kevin Franklin Kim 2023-02-20 11:22:28 +01:00 committed by GitHub
commit ad6df3c12a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 23 deletions

View File

@ -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 ./...

31
.github/workflows/releases.yml vendored Normal file
View File

@ -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 }}

2
.goreleaser.yml Normal file
View File

@ -0,0 +1,2 @@
builds:
- skip: true