-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tim Bray <tbray@textuality.com>
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Release | ||
|
||
on: | ||
# release will only be created when ref is a tag starting with "v" | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
required: true | ||
type: string | ||
description: Use this existing Git tag to create the release | ||
|
||
jobs: | ||
release: | ||
name: Create Release | ||
timeout-minutes: 10 | ||
strategy: | ||
matrix: | ||
go-version: ["1.19"] | ||
platform: ["ubuntu-latest"] | ||
runs-on: ${{ matrix.platform }} | ||
env: | ||
TAG: ${{ github.event.inputs.tag }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c | ||
with: | ||
fetch-depth: 0 | ||
ref: "main" | ||
|
||
- name: Get short TAG | ||
if: ${{ github.event_name != 'workflow_dispatch' }} | ||
run: | | ||
echo "Retrieving tag from Github ref" | ||
echo "TAG=$(basename "${{ github.ref }}")" >> $GITHUB_ENV | ||
- name: Create CHANGELOG for Release (tag) | ||
env: | ||
IMAGE: quay.io/git-chglog/git-chglog | ||
# https://quay.io/repository/git-chglog/git-chglog from tag v0.14.2 | ||
IMAGE_SHA: 998e89dab8dd8284cfff5f8cfb9e9af41fe3fcd4671f2e86a180e453c20959e3 | ||
run: | | ||
# generate CHANGELOG for this Github release tag only | ||
echo "Using tag $TAG to create release notes" | ||
docker run --rm -v $PWD:/workdir ${IMAGE}@sha256:${IMAGE_SHA} -o RELEASE_CHANGELOG.md $TAG | ||
# send to job summary | ||
cat RELEASE_CHANGELOG.md >> $GITHUB_STEP_SUMMARY | ||
- name: Create Github Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
echo "Using tag $TAG to create release" | ||
gh release create -F RELEASE_CHANGELOG.md ${TAG} LICENSE README.md | ||