Bump the dependencies group across 1 directory with 6 updates #21
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: Test and Publish Image | |
on: | |
push: | |
branches: | |
- 'develop' | |
tags: | |
- '*' | |
pull_request: | |
env: | |
GO_VERSION: "1.23" | |
BUILD_PLATFORMS: linux/amd64,linux/arm64 | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build | |
run: make build | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.60 | |
- name: Unit test | |
run: make test | |
- name: Check for git changes | |
run: git diff --exit-code || { echo "Make sure to commit doc changes"; exit 1; } | |
publish: | |
runs-on: ubuntu-latest | |
needs: test | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Don't use merge ref to ensure sha- image tag is accurate | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: meta | |
name: Extract Docker metadata | |
uses: docker/metadata-action@v5 | |
env: | |
DOCKER_METADATA_PR_HEAD_SHA: "true" | |
with: | |
images: | | |
ghcr.io/steved/kubewire | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha | |
- name: Go build cache for Docker | |
uses: actions/cache@v4 | |
with: | |
path: go-build-cache | |
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum', 'Dockerfile') }} | |
- name: inject go-build-cache into docker | |
uses: reproducible-containers/buildkit-cache-dance@v3 | |
with: | |
cache-map: | | |
{ | |
"go-build-cache": "/root/.cache/go-build" | |
} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
provenance: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ env.BUILD_PLATFORMS }} | |
cache-from: type=gha, scope=${{ github.job }} | |
cache-to: type=gha, scope=${{ github.job }} | |
release: | |
runs-on: ubuntu-latest | |
needs: publish | |
permissions: | |
contents: write | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: '~> v2' | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |