-
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (62 loc) · 1.93 KB
/
release.yml
File metadata and controls
70 lines (62 loc) · 1.93 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Release (Tagged)
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v0.1.1-testnet)"
required: false
permissions:
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Derive tag
id: vars
run: |
if [ -n "${{ github.event.inputs.tag }}" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "tag=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
fi
echo "version=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
- name: Find release note
id: note
run: |
TAG="${{ steps.vars.outputs.tag }}"
BASE=${TAG#v}
FILE="docs/RELEASE_NOTE_${BASE//./_^^}.md"
# Fallback to testnet uppercase transform
if [ ! -f "$FILE" ]; then
ALT="docs/RELEASE_NOTE_${BASE//./_ | tr '[:lower:]' '[:upper:]' }.md"
fi
if [ -f "$FILE" ]; then
echo "path=$FILE" >> $GITHUB_OUTPUT
else
echo "path=CHANGELOG.md" >> $GITHUB_OUTPUT
fi
- name: Read body
id: body
run: |
BODY_PATH="${{ steps.note.outputs.path }}"
echo "Using body file: $BODY_PATH"
echo 'BODY<<EOF' >> $GITHUB_OUTPUT
sed 's/\r$//' "$BODY_PATH" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.vars.outputs.tag }}
name: ${{ steps.vars.outputs.tag }}
draft: false
prerelease: true
body: ${{ steps.body.outputs.BODY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Summary
run: echo "Release published for ${{ steps.vars.outputs.tag }}" >> $GITHUB_STEP_SUMMARY