Merge pull request #18 from rmhubbert/dependabot/go_modules/github.co… #112
This file contains hidden or 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
| # This workflow will build, lint and test a golang project. | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
| name: Analyse, lint, test & release | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| jobs: | |
| ################################################# | |
| # Run a static analysis | |
| ################################################# | |
| # analyse: | |
| # name: Perform static analysis | |
| # runs-on: ubuntu-22.04 | |
| # steps: | |
| # - name: Checkout code | |
| # uses: actions/checkout@v4 | |
| # with: | |
| # token: ${{ github.token }} | |
| # | |
| # - name: Set up Go | |
| # uses: actions/setup-go@v5 | |
| # with: | |
| # go-version: 1.23.x | |
| # | |
| # - name: Static analysis | |
| # uses: dominikh/staticcheck-action@v1.3.1 | |
| # with: | |
| # version: 2024.1.1 | |
| ################################################# | |
| # Run various linters | |
| ################################################# | |
| lint: | |
| name: Analyse & Lint | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ github.token }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.11 | |
| ################################################# | |
| # Run tests | |
| ################################################# | |
| test: | |
| name: Test | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ github.token }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Unit Tests | |
| run: go test -race -vet=off -v ./... | |
| ################################################# | |
| # Update version tag | |
| ################################################# | |
| semver-bump: | |
| name: Increment the version | |
| needs: [lint, test] | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| next-version: ${{ steps.semver.outputs.next }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Calculate next version | |
| id: semver | |
| uses: ietf-tools/semver-action@v1 | |
| with: | |
| token: ${{ github.token }} | |
| branch: main | |
| majorList: "build!, ci!, docs!, feat!, fix!, perf!, refactor!, style!, test!" | |
| minorList: "feat, docs" | |
| patchList: "fix, perf, refactor, test, ci, build" | |
| noNewCommitBehavior: silent | |
| noVersionBumpBehavior: silent | |
| - name: Push next version tag | |
| uses: thejeff77/action-push-tag@v1.0.0 | |
| with: | |
| tag: ${{ steps.semver.outputs.next }} | |
| message: "${{ steps.semver.outputs.next }}" | |
| ################################################# | |
| # Update changelog and release | |
| ################################################# | |
| release: | |
| name: Create a new release | |
| needs: [semver-bump] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Update CHANGELOG | |
| id: changelog | |
| uses: requarks/changelog-action@v1.10.3 | |
| with: | |
| token: ${{ github.token }} | |
| tag: ${{ needs.semver-bump.outputs.next-version }} | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| allowUpdates: true | |
| draft: false | |
| makeLatest: true | |
| prerelease: false | |
| name: ${{ needs.semver-bump.outputs.next-version }} | |
| tag: ${{ needs.semver-bump.outputs.next-version }} | |
| body: ${{ steps.changelog.outputs.changes }} | |
| token: ${{ github.token }} | |
| - name: Commit CHANGELOG.md | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| branch: main | |
| commit_message: "docs: update CHANGELOG.md for ${{ needs.semver-bump.outputs.next-version }} [skip ci]" | |
| file_pattern: CHANGELOG.md |