chore: update the repo to use the new template #84
Workflow file for this run
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 | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
pull-requests: read | |
jobs: | |
commitlint: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # fetch-depth is required | |
- uses: wagoid/commitlint-github-action@v6 | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for pre-commit to be able scan history | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: go install ./... | |
- name: go-vet | |
run: go vet -v ./... | |
- name: go-test | |
run: go test -v ./... | |
- uses: pre-commit/action@v3.0.1 | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- commitlint | |
- test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- run: go version | |
- name: Get branch names | |
id: branch-name | |
uses: tj-actions/branch-names@v6 | |
with: | |
strip_tag_prefix: v | |
- name: Generate version info | |
id: version | |
run: | | |
if [ "${{ steps.branch-name.outputs.is_tag }}" = "true" ]; | |
then | |
echo "version=${{ steps.branch-name.outputs.tag }}" >> "$GITHUB_OUTPUT" | |
else | |
echo "version=development" >> "$GITHUB_OUTPUT" | |
fi | |
echo "commit_id=${GITHUB_SHA}" >> "$GITHUB_OUTPUT" | |
echo "gitRepo=github.com/${GITHUB_REPOSITORY}" >> "$GITHUB_OUTPUT" | |
- name: Compile binaries | |
run: ./hack/build.sh | |
env: | |
GIT_COMMIT: ${{ steps.version.outputs.commit_id }} | |
GIT_REPO: ${{ steps.version.outputs.gitRepo }} | |
RELEASE_VERSION: ${{ steps.version.outputs.version }} | |
- uses: actions/setup-node@v4 | |
if: steps.branch-name.outputs.is_tag == 'true' | |
- name: Build Changelog | |
id: github_release | |
uses: mikepenz/release-changelog-builder-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release | |
if: steps.branch-name.outputs.is_tag == 'true' | |
uses: softprops/action-gh-release@v1 | |
with: | |
body: ${{steps.github_release.outputs.changelog}} | |
files: dist/* |