Skip to content

Commit 99cce88

Browse files
authored
ci: Release job after tag creations (#185)
1 parent 343bc84 commit 99cce88

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,17 @@ jobs:
136136
labels: ${{ steps.meta.outputs.labels }}
137137
cache-from: type=gha
138138
cache-to: type=gha,mode=max
139+
140+
- name: Create draft release
141+
# Triggered only on tag creation
142+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
143+
run: |
144+
sudo apt install zip -y
145+
ls build
146+
mv build/main.wasm build/coraza-proxy-wasm.wasm
147+
tag="${GITHUB_REF#refs/tags/}"
148+
zip -j build/coraza-proxy-wasm-${tag}.zip build/coraza-proxy-wasm.wasm
149+
./.github/workflows/release_notes.sh ${tag} > release-notes.txt
150+
gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/} ./build/coraza-proxy-wasm-${tag}.zip
151+
env:
152+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release_notes.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh -ue
2+
# Copyright The OWASP Coraza contributors
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
#
6+
# Highly inspired by https://github.com/tetratelabs/wazero/blob/main/.github/workflows/release_notes.sh
7+
#
8+
# This script generates the release notes for a specific release tag.
9+
# .github/workflows/release_notes.sh v1.3.0
10+
11+
tag=$1
12+
prior_tag=$(git tag -l 'v*'|sed "/${tag}/,+10d"|tail -1)
13+
if [ -n "${prior_tag}" ]; then
14+
range="${prior_tag}..${tag}"
15+
else
16+
range=${tag}
17+
fi
18+
19+
git config log.mailmap true
20+
changelog=$(git log --format='%h %s %aN, %(trailers:key=co-authored-by)' "${range}")
21+
22+
# strip the v off the tag name more shell portable than ${tag:1}
23+
version=$(echo "${tag}" | cut -c2-100) || exit 1
24+
cat <<EOF
25+
coraza-proxy-wasm ${version}
26+
27+
TODO: classify the below into up to 4 major headings and the rest as bulleted items in other changes
28+
The published release notes should only include the summary statement in this section.
29+
30+
${changelog}
31+
32+
## X packages
33+
34+
Don't forget to cite who was involved and why
35+
36+
## Other changes
37+
38+
TODO: don't add trivial things like fixing spaces or non-concerns like build glitches
39+
40+
* Z is now fixed thanks to Yogi Bear
41+
42+
EOF

0 commit comments

Comments
 (0)