Skip to content

feat(*): using common Logger #23

feat(*): using common Logger

feat(*): using common Logger #23

name: Release & Publish
on:
push:
tags: ["v*.*.**"]
workflow_dispatch:
inputs:
tag:
description: "Target tag to release/publish"
required: true
type: string
job:
description: "Choose job to run"
required: true
default: 'both'
type: choice
options:
- both
- release
- publish
jobs:
release:
name: goreleaser-cross
runs-on: ubuntu-latest
container:
image: ghcr.io/goreleaser/goreleaser-cross:latest
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && (inputs.job == 'release' || inputs.job == 'both')) }}
steps:
- uses: actions/checkout@master
with:
ref: "${{ inputs.tag || github.ref_name }}"
- run: git config --global --add safe.directory "$(pwd)"
- run: goreleaser release
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
publish:
name: publish images
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && (inputs.job == 'publish' || inputs.job == 'both')) }}
steps:
- uses: actions/checkout@master
with:
ref: "${{ inputs.tag || github.ref_name }}"
- uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/[email protected]
with:
push: true
build-args: "VERSION=${{ inputs.tag || github.ref_name }}"
tags: "ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ inputs.tag || github.ref_name }}"