feat: add docker image push to ghcr
This commit is contained in:
@@ -5,11 +5,18 @@ on:
|
||||
# run only against tags
|
||||
tags:
|
||||
- '*'
|
||||
# workflow_dispatch: #
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Release version tag (e.g., v1.2.3).'
|
||||
required: true
|
||||
type: string
|
||||
# release:
|
||||
# types: [published]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
# packages: write
|
||||
packages: write
|
||||
# issues: write
|
||||
|
||||
jobs:
|
||||
@@ -31,13 +38,20 @@ jobs:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Docker Login
|
||||
- name: Docker Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: docker.io
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASSWD }}
|
||||
|
||||
- name: Docker Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.REPO_GITHUB_TOKEN }}
|
||||
|
||||
- uses: actions/setup-go@main
|
||||
with:
|
||||
go-version: '>=1.20.2'
|
||||
@@ -61,7 +75,12 @@ jobs:
|
||||
|
||||
- name: Get Release version
|
||||
id: get_version
|
||||
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Update Local Version File
|
||||
run: echo ${{ steps.get_version.outputs.VERSION }} > .release_version
|
||||
@@ -76,6 +95,7 @@ jobs:
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
|
||||
GORELEASER_CURRENT_TAG: ${{ steps.get_version.outputs.VERSION }}
|
||||
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro'
|
||||
# distribution:
|
||||
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
|
||||
Reference in New Issue
Block a user