Skip to content

Bump golang from 1.21.6 to 1.22.0 #390

Bump golang from 1.21.6 to 1.22.0

Bump golang from 1.21.6 to 1.22.0 #390

Workflow file for this run

name: Go
on:
push:
branches: [master]
pull_request:
branches: [master]
create:
tags:
- v*
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.16
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Build
run: |
go build -v .
go clean
- name: Test
run: go test -v ./... -covermode=count -coverprofile=coverage.out
- name: Convert coverage to lcov
if: startsWith(github.ref, 'refs/master')
uses: jandelgado/gcov2lcov-action@v1.0.9
with:
infile: coverage.out
outfile: coverage.lcov
- name: Upload coverages
if: startsWith(github.ref, 'refs/master')
uses: coverallsapp/github-action@v2.2.3
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: coverage.lcov
- name: Trigger Go Report Card
if: startsWith(github.ref, 'refs/master')
run: curl -d "repo=github.com/fhopfensperger/json-log-to-human-readable" https://goreportcard.com/checks
- name: Clean directory
if: startsWith(github.ref, 'refs/master')
run: rm coverage.lcov
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Set release version
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "RELEASE_VERSION_WITHOUT_V=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Set up QEMU
if: startsWith(github.ref, 'refs/tags/')
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: startsWith(github.ref, 'refs/tags/')
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
BUILD_VERSION=${{ env.RELEASE_VERSION_WITHOUT_V }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION_WITHOUT_V }}