Update build to better detect tags and versions

This commit is contained in:
Ian Fijolek
2026-01-05 16:20:51 -08:00
parent 0a7aab7030
commit afacf40ec8
+9 -11
View File
@@ -3,22 +3,20 @@ on:
push: push:
branches: branches:
- main - main
- master
tags: tags:
- "v*" - "v*"
pull_request: pull_request:
branches: branches:
- main - main
- master
jobs: jobs:
tests: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v6 uses: actions/setup-go@v5
with: with:
go-version-file: go.mod go-version-file: go.mod
@@ -28,15 +26,15 @@ jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v6 uses: actions/setup-go@v5
with: with:
go-version-file: go.mod go-version-file: go.mod
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v5
- name: Run pre-commit - name: Run pre-commit
uses: https://git.iamthefij.com/iamthefij/pre-commit-action@v3.0.2 uses: https://git.iamthefij.com/iamthefij/pre-commit-action@v3.0.2
@@ -55,17 +53,17 @@ jobs:
- name: Build binaries - name: Build binaries
env: env:
VERSION: "${{ vars.REF_NAME }}" VERSION: "${{ github.REF_NAME }}"
run: make all run: make all
# Package binaries and create release if this is a tagged build # Package binaries and create release if this is a tagged build
- name: Compress binaries - name: Compress binaries
if: "${{ github.event_name == 'tag' }}" if: "${{ github.ref_type == 'tag' }}"
run: find ./dist -type f -executable -execdir tar -czvf {}.tar.gz {} \; run: find ./dist -type f -executable -execdir tar -czvf {}.tar.gz {} \;
- name: Upload release - name: Upload release
uses: https://gitea.com/actions/gitea-release-action@v1 uses: https://gitea.com/actions/gitea-release-action@v1
if: "${{ github.event_name == 'tag' }}" if: "${{ github.ref_type == 'tag' }}"
with: with:
files: |- files: |-
dist/*.tar.gz dist/*.tar.gz
@@ -89,6 +87,7 @@ jobs:
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
if: "${{ github.event_name != 'pull_request' }}"
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
@@ -108,6 +107,5 @@ jobs:
platforms: | platforms: |
linux/amd64 linux/amd64
linux/arm64 linux/arm64
linux/arm
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}