blob: 9f80cbac701f8ac68f07a159c6b1844a360c92ab (
plain)
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
49
50
51
52
53
54
55
56
57
|
name: release
# Pushing v1.2.3 creates the release and attaches the source archive. There is
# no binary: whoson only builds on z/OS,
# which no hosted runner provides.
on:
push:
tags: ['v[0-9]*']
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
# v7.0.1, pinned to a commit: a tag can be repointed at other code.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
fetch-depth: 0
- name: tag matches VERSION
run: |
version=$(sed -n 's/^VERSION[[:space:]]*=[[:space:]]*//p' Makefile)
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
echo "tag $GITHUB_REF_NAME does not match VERSION=$version" >&2
exit 1
fi
echo "VERSION=$version" >> "$GITHUB_ENV"
- name: source archive
run: |
git archive --format=tar.gz --prefix="whoson-$VERSION/" \
-o "whoson-$VERSION.tar.gz" "$GITHUB_SHA"
sha256sum "whoson-$VERSION.tar.gz" > "whoson-$VERSION.tar.gz.sha256"
- name: notes from the changelog
run: |
awk -v v="$VERSION" \
'BEGIN { p = 0 }
$0 ~ "^## " v "$" { p = 1; next }
p && /^## / { exit }
p' CHANGELOG.md > notes.md
if [ ! -s notes.md ]; then
echo "CHANGELOG.md has no '## $VERSION' section" >&2
exit 1
fi
- name: release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "whoson $VERSION" \
--notes-file notes.md \
"whoson-$VERSION.tar.gz" "whoson-$VERSION.tar.gz.sha256"
|