Skip to content

chore: add release automation #4

chore: add release automation

chore: add release automation #4

Workflow file for this run

# 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
- run: go generate ./...
- run: 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
- run: 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: [check-generated, test, lint]
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 }}
config-file: .github/release-please-config.json
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 --config .github/.goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}