chore: add release automation #1
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: {} | ||
jobs: | ||
check-generated: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.22" | ||
- run: | | ||
go mod tidy | ||
go generate ./... | ||
git diff --exit-code | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.22" | ||
- run: | | ||
go install | ||
go test -cover ./... | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.22" | ||
- uses: golangci/golangci-lint-action@v4 | ||
with: | ||
version: v1.59.1 | ||
release-please: | ||
runs-on: ubuntu-latest | ||
needs: [generate, test, lint] | ||
Check failure on line 46 in .github/workflows/ci.yaml GitHub Actions / .github/workflows/ci.yamlInvalid workflow file
|
||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
outputs: | ||
release_created: ${{ steps.release-please.outputs.release_created }} | ||
tag_name: ${{ steps.release-please.outputs.tag_name }} | ||
version: ${{ steps.release-please.outputs.version }} | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
with: | ||
token: ${{ secrets.PAT }} | ||
release-type: go | ||
bump-minor-pre-major: true | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [release-please] | ||
if: needs.release-please.outputs.release_created | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --tags --force | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.22" | ||
- uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
version: "~> v2" | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |