Skip to content

chore(deps): bump the go_modules group across 2 directories with 6 updates #190

chore(deps): bump the go_modules group across 2 directories with 6 updates

chore(deps): bump the go_modules group across 2 directories with 6 updates #190

Workflow file for this run

name: Build
on:
- pull_request
- push
permissions:
contents: write
packages: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '>=1.19.0'
- name: Go install
run: go install ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
- name: go-fmt-import
uses: Jerome1337/[email protected]
- name: go-vet
run: go vet -v ./...
- name: gofumpt
run: |
go install mvdan.cc/gofumpt@latest
LIST_OF_FILES=$(gofumpt -l .)
echo "$LIST_OF_FILES"
if [ -n "$LIST_OF_FILES" ]; then
exit 1
fi
- name: go-err-check
run: |
go install github.com/kisielk/errcheck@latest
errcheck ./...
- name: go-static-check
uses: dominikh/[email protected]
with:
install-go: false
build:
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '>=1.19.0'
- run: go version
- name: Install Go dependencies
run: go install ./...
- name: Lint Go
uses: golangci/golangci-lint-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v6
with:
strip_tag_prefix: v
- name: Generate Docker tag
id: docker
run: |
if [ "${{ steps.branch-name.outputs.is_tag }}" = "true" ];
then
# Latest tag
IMG_NAME="ghcr.io/${GITHUB_REPOSITORY,,}:latest"
# Tag name (usually vX.Y.Z)
IMG_NAME="${IMG_NAME},ghcr.io/${GITHUB_REPOSITORY,,}:${{ steps.branch-name.outputs.tag }}"
echo "image_name=${IMG_NAME}" >> "$GITHUB_OUTPUT"
echo "platforms=linux/amd64,linux/arm64,linux/arm/v7" >> "$GITHUB_OUTPUT"
else
# Use branch naming convention
TAG="branch-${{ steps.branch-name.outputs.current_branch }}"
# Change "/" for "-"
TAG="${TAG//\//-}"
# Set to lowercase
TAG="${TAG,,}"
echo "image_name=ghcr.io/${GITHUB_REPOSITORY,,}:${TAG}" >> "$GITHUB_OUTPUT"
echo "platforms=linux/amd64" >> "$GITHUB_OUTPUT"
fi
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: Build and push
uses: docker/build-push-action@v3
with:
context: .
build-args: |
GIT_COMMIT=${{ steps.docker.outputs.commit_id }}
GIT_REPO=${{ steps.docker.outputs.gitRepo }}
VERSION=${{ steps.docker.outputs.version }}
platforms: ${{ steps.docker.outputs.platforms }}
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.docker.outputs.image_name }}
- name: Run GoReleaser
if: steps.branch-name.outputs.is_tag == 'true'
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GIT_REPO: ${{ steps.docker.outputs.gitRepo }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}