fix permissions #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
packages: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- 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: Create fake tag | |
id: fake-tag | |
run: | | |
CURRENT_TAG=$(git describe --tag --always) | |
git tag ${CURRENT_TAG} | |
echo "CURRENT_TAG=${CURRENT_TAG}" >> "$GITHUB_OUTPUT" | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: v2 | |
args: --clean | |
env: | |
GORELEASER_CURRENT_TAG: ${{ steps.fake-tag.outputs.CURRENT_TAG }} |