43 lines
1.0 KiB
YAML
43 lines
1.0 KiB
YAML
name: Go Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# We need to set a cache marker to ensure that the cache is individual for each job.
|
|
- name: Add Cache Marker
|
|
run: echo "go-build" > env.txt
|
|
|
|
- name: Install Go
|
|
id: install-go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
cache-dependency-path: |
|
|
go.sum
|
|
env.txt
|
|
|
|
- name: Download dependencies
|
|
run: go mod download
|
|
if: steps.install-go.outputs.cache-hit != 'true'
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v6
|
|
env:
|
|
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
|
|
DOCKER_REPOSITORY: ullaakut/cameradar
|
|
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} |