Skip to content

Gorelease

Gorelease #5

Workflow file for this run

name: Gorelease
on:
push:
pull_request:
workflow_dispatch:
inputs:
registry:
type: choice
description: Select the container registry
options:
- dockerhub
- ghcr.io
env:
GH_TOKEN: ${{ github.token }}
permissions:
contents: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
- name: "Read secrets"
uses: rancher-eio/read-vault-secrets@main
if: "${{ github.event.inputs.registry == 'dockerhub' }}"
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | DOCKER_PASSWORD ;
- name: Login to Docker Container Registry
uses: docker/login-action@v3
if: "${{ github.event.inputs.registry == 'dockerhub' }}"
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
# trigger login also for push
if: "${{ github.event.inputs.registry != 'dockerhub' }}"
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: v2
args: --clean