Skip to content

Release

Release #22

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release'
required: true
jobs:
goreleaser:
name: Release Binaries
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/setup-go@v4
with:
go-version: 1.19
# only run this step when the tag is not already created
- if: startsWith(github.ref, 'refs/tags/') != 'true' && github.event.inputs.tag != ''
name: Create and Push Tag
run: |-
git config --global user.email "divkix@divkix.me"
git config --global user.name "Divanshu Chauhan"
tag=${{ github.event.inputs.tag }} # if triggered by workflow_dispatch
if [ -z "$tag" ]; then
tag=${GITHUB_REF#refs/tags/}
fi
git tag -f -a -m "$tag" "$tag"
git push -f origin "$tag"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}