Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
View runs Go to file
 
 
Cannot retrieve contributors at this time
name: "Release a tag"
on:
push:
tags:
- v*
jobs:
release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
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.19
- name: Unshallow
run: git fetch --prune --unshallow
- name: Create release
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
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@v3
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.19
- 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 ::set-output name=tag_name::${TAG}
echo ::set-output name=major_tag::${MAJOR}
echo ::set-output name=short_commit::${SHORT_COMMIT}
echo ::set-output name=date::${DATE}
if [[ ${{ matrix.target.Dockerfile }} == *"alpine"* ]]; then
echo ::set-output name=full_tag_name::${TAG}-alpine
echo ::set-output name=full_major_tag::${MAJOR}-alpine
echo ::set-output name=latest_tag::latest-alpine
else
echo ::set-output name=full_tag_name::${TAG}
echo ::set-output name=full_major_tag::${MAJOR}
echo ::set-output name=latest_tag::latest
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@v3
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 }}