build(deps): bump mathieudutour/github-tag-action from 6.1 to 6.2 #165
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: Build Test and Release | |
on: | |
push: | |
branches: | |
- main | |
- beta | |
- "feature/*" | |
- "fix/*" | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
version: | |
name: Generate version and tag | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }} | |
PreReleaseTagWithDash: ${{ steps.gitversion.outputs.PreReleaseTagWithDash }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: "5.x" | |
- name: Use GitVersion | |
id: gitversion # step id used as reference for output values | |
uses: gittools/actions/gitversion/[email protected] | |
- name: Create annotation for build error | |
run: | | |
echo "::notice::FullSemVer ${{ steps.gitversion.outputs.FullSemVer }}" | |
echo "::notice::PreReleaseTagWithDash ${{ steps.gitversion.outputs.PreReleaseTagWithDash }}" | |
- name: Bump version and push tag # https://github.com/marketplace/actions/github-tag | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ steps.gitversion.outputs.FullSemVer }} | |
tag_prefix: v | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.20 | |
id: go | |
- name: Run go build | |
run: go build -v ./... | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.20 | |
id: go | |
- name: Test | |
run: go test -v -race ./... | |
- name: Go Vet | |
run: go vet ./... | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.20 | |
id: go | |
- name: Run golangci-lint # https://github.com/marketplace/actions/run-golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [build, test, lint, version] | |
if: contains(github.ref, 'main') | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.20 | |
id: go | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
if: ${{ needs.version.outputs.PreReleaseTagWithDash == '' }} | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |