chore(ci): only release after CI on main passes #110
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
name: CI | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
env: | |
GOPROXY: direct | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cashapp/activate-hermit@v1 | |
- run: | | |
find . -name go.mod | grep -v /testdata | xargs -n1 dirname | while read dir; do ( | |
cd "$dir" | |
go mod tidy | |
go test -v ./... | |
); done | |
git diff | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
env: | |
GOPROXY: direct | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cashapp/activate-hermit@v1 | |
- run: | | |
find . -name go.mod | grep -v /testdata | xargs -n1 dirname | while read dir; do ( | |
cd "$dir" | |
go mod tidy | |
golangci-lint run | |
); done | |
git diff | |
release: | |
name: Release | |
# Only try release on main branch | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: ["test", "lint"] | |
steps: | |
- uses: ./.github/workflows/release |