Also, it's a bit less boilerplate code. Seen here¹: ¹: https://github.com/dependabot/dependabot-core/blob/v0.120.3/.github/workflows/docker.yml#L27-L29
52 lines
1.2 KiB
YAML
52 lines
1.2 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*.*.*
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Load Go version
|
|
id: go-version
|
|
run: |
|
|
echo "::set-output name=go-version::$(tr -d '\n' < .github/versions/go)"
|
|
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ steps.go-version.outputs.go-version }}
|
|
|
|
- name: Select custom release notes
|
|
id: release-notes
|
|
run: |
|
|
RELNOTES="docs/release-notes/RELEASE-${GITHUB_REF#refs/tags/}.md"
|
|
[[ -f "$RELNOTES" ]] && echo ::set-output name=ARGS::--release-notes $RELNOTES || true
|
|
|
|
- name: Docker Login
|
|
run: |
|
|
username="${{ secrets.DOCKERHUB_USERNAME }}"
|
|
password="${{ secrets.DOCKERHUB_PASSWORD }}"
|
|
echo "$password" | docker login --username "$username" --password-stdin
|
|
|
|
- name: Load GPG private key
|
|
run: |
|
|
echo "${{ secrets.GPG_PRIVATE_KEY" }} | gpg --import
|
|
|
|
- uses: goreleaser/goreleaser-action@v2
|
|
with:
|
|
args: release --rm-dist ${{ steps.release-notes.outputs.ARGS }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Clear ~/.gnupg
|
|
run: |
|
|
rm -rf ~/.gnupg
|