-
Notifications
You must be signed in to change notification settings - Fork 311
182 lines (171 loc) · 8.24 KB
/
build-changelogs.yml
File metadata and controls
182 lines (171 loc) · 8.24 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
176
177
178
179
180
181
182
name: Build Changelogs
on:
workflow_call:
inputs:
current-version:
description: 'Current Version'
required: true
type: string
make-latest:
description: 'Make Latest'
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
current-version:
type: string
description: 'Current Version'
required: true
previous-rc-version:
type: string
description: 'Previous RC Version'
required: true
previous-gold-version:
type: string
description: 'Previous Gold Version'
required: true
permissions:
contents: write
jobs:
changelogs:
name: Generate Changelogs
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'hpcc-systems' }}
steps:
- name: Checkout HPCC-Platform
uses: actions/checkout@v6
with:
ref: refs/tags/community_${{ inputs.current-version }}
submodules: recursive
path: HPCC-Platform
fetch-tags: true
fetch-depth: 0
- name: Checkout LN
uses: actions/checkout@v6
with:
repository: ${{ github.repository_owner }}/LN
ref: refs/tags/internal_${{ inputs.current-version }}
submodules: recursive
token: ${{ secrets.LNB_TOKEN}}
path: LN
fetch-tags: true
fetch-depth: 0
- name: Checkout ECLIDE
uses: actions/checkout@v6
with:
repository: ${{ github.repository_owner }}/ECLIDE
ref: refs/tags/eclide_${{ inputs.current-version }}
submodules: recursive
path: ECLIDE
fetch-tags: true
fetch-depth: 0
- name: Checkout PrettyGitLogs
uses: actions/checkout@v6
with:
repository: hpcc-systems/PrettyGitLogs
ref: master
path: PrettyGitLogs
- name: Get Previous Versions for workflow call
if: ${{ github.event_name != 'workflow_dispatch' }}
id: get_version
shell: bash
working-directory: HPCC-Platform
run: |
set -x
tag=$(git describe --exact-match --tags 2>/dev/null)
version=$(echo $tag | cut -d_ -f2)
major=$(echo $version | cut -d. -f1)
minor=$(echo $version | cut -d. -f2)
point=$(echo $version | cut -d. -f3 | cut -d- -f1)
type=$(echo $version | cut -d- -f2)
# For RC releases beyond rc1, derive the previous RC in the same version series
if [[ "$type" =~ ^rc([0-9]+)$ ]]; then
rc_num=${BASH_REMATCH[1]}
if (( rc_num > 1 )); then
prev_rc_num=$((rc_num - 1))
prev_rc_tag="community_${major}.${minor}.${point}-rc${prev_rc_num}"
previous_rc=$(git tag --list "$prev_rc_tag" | head -n 1 | cut -d_ -f2 2>/dev/null)
fi
fi
if [[ "$type" != rc* ]]; then
previous_gold=$(git tag --sort=-v:refname | grep -E "^community_$major\.$minor\.$point-[0-9]+$" | tail -n +2 | head -n 1 | cut -d_ -f2 2>/dev/null)
fi
# Find previous gold version
if [[ -z "$previous_gold" ]]; then
if [[ $point -eq 0 ]]; then
if [[ $minor -eq 0 ]]; then
major_prev=$((major - 1))
previous_gold=$(git tag --sort=-v:refname | grep -E "^community_$major_prev\.[0-9]*\.[0-9]*-[0-9]+$" | head -n 1 | cut -d_ -f2 2>/dev/null)
# For rc1, find previous RC from previous version
if [[ "$type" == "rc1" ]] || [[ -z "$previous_rc" ]]; then
previous_rc=$(git tag --sort=-v:refname | grep -E "^community_$major_prev\.[0-9]*\.[0-9]*-rc[0-9]+$" | head -n 1 | cut -d_ -f2 2>/dev/null)
fi
else
minor_prev=$((minor - 2))
previous_gold=$(git tag --sort=-v:refname | grep -E "^community_$major\.$minor_prev\.[0-9]*-[0-9]+$" | head -n 1 | cut -d_ -f2 2>/dev/null)
# For rc1, find previous RC from previous version
if [[ "$type" == "rc1" ]] || [[ -z "$previous_rc" ]]; then
previous_rc=$(git tag --sort=-v:refname | grep -E "^community_$major\.$minor_prev\.[0-9]*-rc[0-9]+$" | head -n 1 | cut -d_ -f2 2>/dev/null)
fi
fi
else
point_prev=$((point - 2))
previous_gold=$(git tag --sort=-v:refname | grep -E "^community_$major\.$minor\.$point_prev-[0-9]+$" | head -n 1 | cut -d_ -f2 2>/dev/null)
# For rc1, find previous RC from previous version
if [[ "$type" == "rc1" ]] || [[ -z "$previous_rc" ]]; then
previous_rc=$(git tag --sort=-v:refname | grep -E "^community_$major\.$minor\.$point_prev-rc[0-9]+$" | head -n 1 | cut -d_ -f2 2>/dev/null)
fi
fi
fi
echo "current_version=$version" >> $GITHUB_OUTPUT
echo "previous_rc_version=$previous_rc" >> $GITHUB_OUTPUT
echo "previous_gold_version=$previous_gold" >> $GITHUB_OUTPUT
echo "type=$type" >> $GITHUB_OUTPUT
- name: Print Vars
if: ${{ github.event_name != 'workflow_dispatch' }}
shell: bash
run: |
echo "${{ toJSON(steps.get_version.outputs) }}"
- name: Generate Changelogs
shell: bash
working-directory: PrettyGitLogs
run: |
./prettyLogs_setup.sh
set -x
echo "pwd = $(pwd)"
sed -i -e '/^JIRAUser/c\JIRAUser=${{ secrets.JIRA_USERNAME}}' prettylogs.conf
sed -i -e '/^JIRAPW/c\JIRAPW=${{ secrets.JIRA_TOKEN }}' prettylogs.conf
cat prettylogs.conf
if [[ "${{ github.event_name }}" != 'workflow_dispatch' ]]; then
type=${{ steps.get_version.outputs.type }}
current_version=${{ steps.get_version.outputs.current_version }}
previous_rc_version=${{ steps.get_version.outputs.previous_rc_version }}
previous_gold_version=${{ steps.get_version.outputs.previous_gold_version }}
else
type=$(echo "${{ github.event.inputs.current-version }}" | cut -d- -f2)
current_version=${{ github.event.inputs.current-version }}
previous_rc_version=${{ github.event.inputs.previous-rc-version }}
previous_gold_version=${{ github.event.inputs.previous-gold-version }}
fi
if [[ ! "${type}" == *"rc"* ]]; then
perl ./prettyLogs.pl -bt community_${current_version} -et community_${previous_gold_version} -repo ../HPCC-Platform -sort -html community_${current_version}
perl ./prettyLogs.pl -bt internal_${current_version} -et internal_${previous_gold_version} -repo ../LN -sort -html internal_${current_version}
perl ./prettyLogs.pl -bt eclide_${current_version} -et eclide_${previous_gold_version} -repo ../ECLIDE -sort -html eclide_${current_version}
elif [ "${type}" == "rc1" ]; then
perl ./prettyLogs.pl -bt community_${current_version} -et community_${previous_gold_version} -repo ../HPCC-Platform -sort -html community_${current_version}
perl ./prettyLogs.pl -bt internal_${current_version} -et internal_${previous_gold_version} -repo ../LN -sort -html internal_${current_version}
perl ./prettyLogs.pl -bt eclide_${current_version} -et eclide_${previous_gold_version} -repo ../ECLIDE -sort -html eclide_${current_version}
else
perl ./prettyLogs.pl -bt community_${current_version} -et community_${previous_rc_version} -repo ../HPCC-Platform -sort -html community_${current_version}
perl ./prettyLogs.pl -bt internal_${current_version} -et internal_${previous_rc_version} -repo ../LN -sort -html internal_${current_version}
perl ./prettyLogs.pl -bt eclide_${current_version} -et eclide_${previous_rc_version} -repo ../ECLIDE -sort -html eclide_${current_version}
fi
- name: Upload Changelogs
uses: ncipollo/release-action@v1
with:
allowUpdates: true
generateReleaseNotes: false
prerelease: ${{ contains(github.ref, '-rc') }}
makeLatest: ${{ inputs.make-latest }}
artifacts: PrettyGitLogs/community_*.html,PrettyGitLogs/internal_*.html,PrettyGitLogs/eclide_*.html