Skip to content

fix: add all directories as safe git directories inside the Docker im… #62

fix: add all directories as safe git directories inside the Docker im…

fix: add all directories as safe git directories inside the Docker im… #62

Workflow file for this run

name: "Release a tag"
on:
push:
tags:
- v*
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
# https://github.com/actions/setup-go#supported-version-syntax
# ex:
# - 1.18beta1 -> 1.18.0-beta.1
# - 1.18rc1 -> 1.18.0-rc.1
go-version: '1.21'
- name: Unshallow
run: git fetch --prune --unshallow
- name: Create release
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }}
docker-release:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
target:
- Dockerfile: build/Dockerfile
- Dockerfile: build/alpine.Dockerfile
steps:
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
# https://github.com/actions/setup-go#supported-version-syntax
# ex:
# - 1.18beta1 -> 1.18.0-beta.1
# - 1.18rc1 -> 1.18.0-rc.1
go-version: '1.21'
- name: Unshallow
run: git fetch --prune --unshallow
- name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
MAJOR=${TAG%.*}
SHORT_COMMIT=${GITHUB_SHA::8}
DATE=$(date '+%Y-%m-%dT%H:%M:%SZ')
echo tag_name=${TAG} >> $GITHUB_OUTPUT
echo major_tag=${MAJOR} >> $GITHUB_OUTPUT
echo short_commit=${SHORT_COMMIT} >> $GITHUB_OUTPUT
echo date=${DATE} >> $GITHUB_OUTPUT
if [[ ${{ matrix.target.Dockerfile }} == *"alpine"* ]]; then
echo full_tag_name=${TAG}-alpine >> $GITHUB_OUTPUT
echo full_major_tag=${MAJOR}-alpine >> $GITHUB_OUTPUT
echo latest_tag=latest-alpine >> $GITHUB_OUTPUT
else
echo full_tag_name=${TAG} >> $GITHUB_OUTPUT
echo full_major_tag=${MAJOR} >> $GITHUB_OUTPUT
echo latest_tag=latest >> $GITHUB_OUTPUT
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login do docker.io
run: docker login -u golangci -p ${{ secrets.GOLANGCI_LINT_DOCKER_TOKEN }}
- name: Build and publish ${{ matrix.target.Dockerfile }}
uses: docker/build-push-action@v4
with:
context: .
file: ${{ matrix.target.Dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ steps.prepare.outputs.tag_name }}
SHORT_COMMIT=${{ steps.prepare.outputs.short_commit }}
DATE=${{ steps.prepare.outputs.date }}
tags: |
golangci/golangci-lint:${{ steps.prepare.outputs.full_tag_name }}
golangci/golangci-lint:${{ steps.prepare.outputs.full_major_tag }}
golangci/golangci-lint:${{ steps.prepare.outputs.latest_tag }}