-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (38 loc) · 1.28 KB
/
Copy pathrelease.yml
File metadata and controls
48 lines (38 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: release
on:
push:
tags:
- 'v*'
permissions:
contents: write
# Creates a GitHub Release whose body is the matching `## [X.Y.Z]` block
# from CHANGELOG.md. The tag `vX.Y.Z` must point at a commit where that
# block already exists (rename `## [Unreleased]` to `## [X.Y.Z]` before
# tagging). Release title is the annotated tag subject if present, else
# the tag name. Fails loudly if the CHANGELOG has no matching section.
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME}"
version="${tag#v}"
notes=$(mktemp)
python3 .github/scripts/extract-changelog-section.py \
--file CHANGELOG.md \
--version "$version" \
> "$notes"
echo "--- release notes preview for $tag ---"
cat "$notes"
echo "---"
title=$(git tag -l --format='%(contents:subject)' "$tag")
[ -z "$title" ] && title="$tag"
echo "release title: $title"
gh release create "$tag" \
--title "$title" \
--notes-file "$notes"