Draft releases through synchronous tagging (#320)

* feat: synchronously tag releases

* fix: missing verbose version info in inter-release binaries
This commit is contained in:
lkingland 2021-04-28 06:06:39 +09:00 committed by GitHub
parent 89ff286a1f
commit 255b4fb33c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 5 deletions

View File

@ -49,10 +49,29 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple
bump-minor-pre-major: true
# Checkout and test
# Checkout
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
# Tag
# If a release was created, tag `vX.Y.Z` synchronously which:
# 1. Triggers release-please to create draft release, allowing manual
# proofreading (and probably editing) of release notes.
# (often raw commit messages are a bit overwhelming, overly granular
# or at least could use some context when included as release notes).
# 2. Ensures the tag exists for subsequent action tasks which rely on
# this metadata, such as including version in release binaries.
# The release-please action does add this tag, but asynchronously.
# Note that tag is created annotated such that it shows tagging metadata
# when queried rather than just the associated commit metadata.
- name: tag
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name github-actions[bot]
git tag -d v${{steps.release.outputs.major}}.${{steps.release.outputs.minor}}.${{steps.release.outputs.patch}} || true
git push origin :v${{steps.release.outputs.major}}.${{steps.release.outputs.minor}}.${{steps.release.outputs.patch}} || true
git tag -a v${{steps.release.outputs.major}}.${{steps.release.outputs.minor}}.${{steps.release.outputs.patch}} -m "Release v${{steps.release.outputs.major}}.${{steps.release.outputs.minor}}.${{steps.release.outputs.patch}}"
git push origin v${{steps.release.outputs.major}}.${{steps.release.outputs.minor}}.${{steps.release.outputs.patch}} || true
- uses: actions/setup-go@v2
- name: Install pkger
run: |
curl -s -L -o pkger.tgz ${{ needs.test.outputs.pkger }}
@ -63,7 +82,14 @@ jobs:
run: make cross-platform
env:
PKGER: "./pkger"
VERS: ${{ steps.release.outputs.tag_name }}
# NOTE:
# release-please adds the version asynchronously. Without using the
# synchonous tagging step above, the version can be explicitly passed
# to the build using the following environment variable. However this
# has the side-effect of causing inter-relese binaries to not include
# verbose version information, because the special version `tip` is
# overriden with a blank string in those cases.
# VERS: ${{ steps.release.outputs.tag_name }}
# Upload all build artifacts whether it's a release or not
- uses: actions/upload-artifact@v2

View File

@ -12,8 +12,8 @@ DATE := $(shell date -u +"%Y%m%dT%H%M%SZ")
HASH := $(shell git rev-parse --short HEAD 2>/dev/null)
VTAG := $(shell git tag --points-at HEAD)
# a VERS environment variable takes precedence over git tags
# due to issues with release-please-action tagging not working
# as expected in CI
# and is necessary with release-please-action which tags asynchronously
# unless explicitly, synchronously tagging as is done in ci.yaml
VERS ?= $(shell [ -z $(VTAG) ] && echo 'tip' || echo $(VTAG) )
TEMPLATE_DIRS=$(shell find templates -type d)