utilize yaml struct to update/insert version number (#19) #33
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
name: CI | |
env: | |
# renovate: github=golangci/golangci-lint | |
GO_LINT_CI_VERSION: v1.61.0 | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
tags: | |
- "v*" | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build & Test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- run: make build | |
- run: go test ./... -timeout 20s -race -covermode=atomic -coverprofile=coverage.out | |
# - run: go test ./... -timeout 20s -bench . -benchmem -count 3 | |
- name: go build (with goreleaser) | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: latest | |
args: release --snapshot | |
env: | |
GITHUB_TOKEN: "" | |
- uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dists | |
path: dist/ | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- run: make build | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: ${{ env.GO_LINT_CI_VERSION }} | |
publish: | |
name: Publish package | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: | |
- build | |
- lint | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GORELEASER_CURRENT_TAG: ${{ github.ref_name }} |