forked from hiero-ledger/hiero-consensus-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflow-generate-release-notes.yaml
More file actions
175 lines (145 loc) · 6.11 KB
/
flow-generate-release-notes.yaml
File metadata and controls
175 lines (145 loc) · 6.11 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# SPDX-License-Identifier: Apache-2.0
name: "Generate Release Notes"
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
version:
description: "Release Version Number (ex: 0.59.2):"
type: string
required: true
defaults:
run:
shell: bash
permissions:
contents: read
jobs:
validate-input-version:
name: Validate Input Version
runs-on: hiero-network-node-linux-medium
outputs:
release-identifier: ${{ steps.validate.outputs.release-identifier }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Extract the Input Version
id: extract-version
run: |
echo "version=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.ref_name }}" >> "${GITHUB_OUTPUT}"
- name: Validate and Correct Release Identifier
id: validate
run: |
release_identifier="${{ steps.extract-version.outputs.version }}"
echo "Input release identifier: '${release_identifier}'"
is_valid=$(semver validate "${release_identifier}")
if [[ "$is_valid" != "valid" ]]; then
echo "Invalid semantic version: ${release_identifier}"
exit 1
fi
cleaned="${release_identifier#v}"
echo "Release identifier is valid: ${cleaned}"
echo "release-identifier=${cleaned}" >> "${GITHUB_OUTPUT}"
echo "Validated Input: ${cleaned}" >> "${GITHUB_STEP_SUMMARY}"
- name: Skip Autogen Release Notes on Release Candidate Tag
run: |
tag="v${{ steps.validate.outputs.release-identifier }}"
if [[ "${{ github.event_name }}" == "push" && ! "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Skipping prerelease tag: $tag" | tee -a "${GITHUB_STEP_SUMMARY}"
exit 1
fi
- name: Checkout Code
id: checkout_code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: "0"
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Validate Tag Exists
run: |
tag="v${{ steps.validate.outputs.release-identifier }}"
echo "Checking if tag ${tag} exists..."
if git rev-parse "${tag}" >/dev/null 2>&1; then
echo "Tag ${tag} found in repo." >> "${GITHUB_STEP_SUMMARY}"
else
echo "Error: Tag ${tag} does not exist in repo." >> "${GITHUB_STEP_SUMMARY}"
exit 1
fi
fixes-and-feats-release-notes:
name: Create Fixes and Feats Release Notes
needs: validate-input-version
runs-on: hiero-network-node-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Checkout Code
id: checkout_code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: "0"
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Git-Semver Setup Action
uses: PandasWhoCode/setup-git-semver@91baf2ca207495aa35db3441038ddeae2b6904c7 # v1.0.2
- name: Create Release Notes - Feats and Fixes Only Markdown Format
run: |
echo "Release Notes - Feats and Fixes Only Markdown Format" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "## Release Notes" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "" | tee -a "${GITHUB_STEP_SUMMARY}"
git-semver log --markdown "${{ needs.validate-input-version.outputs.release-identifier }}" | tee -a "${GITHUB_STEP_SUMMARY}"
full-release-notes:
name: Create Full Release Notes
needs: validate-input-version
runs-on: hiero-network-node-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Checkout Code
id: checkout_code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: "0"
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Git-Semver Setup Action
uses: PandasWhoCode/setup-git-semver@91baf2ca207495aa35db3441038ddeae2b6904c7 # v1.0.2
- name: Get All Changes in JSON Format
run: |
echo "Create Release Notes of Conventional Commits"
git-semver log --conventional-commits "${{ needs.validate-input-version.outputs.release-identifier }}" | tee changes.json
- name: Process All Changes to Markdown File
id: generate-md
run: python3 .github/workflows/support/scripts/process_json_release_notes.py ./changes.json ./RELEASE_NOTES.md
- name: Create Release Notes - Full Markdown Format
run: |
echo "Release Notes - Full Markdown Format" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "## Release Notes" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "" | tee -a "${GITHUB_STEP_SUMMARY}"
cat RELEASE_NOTES.md | tee -a "${GITHUB_STEP_SUMMARY}"
full-commit-history:
name: Full Commit History
needs: validate-input-version
runs-on: hiero-network-node-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Checkout Code
id: checkout_code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: "0"
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Git-Semver Setup Action
uses: PandasWhoCode/setup-git-semver@91baf2ca207495aa35db3441038ddeae2b6904c7 # v1.0.2
- name: Create Full List of Git History Commits
run: |
echo "Create Full List of Git History Commits:"
git-semver log "${{ needs.validate-input-version.outputs.release-identifier }}"