-
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (128 loc) 路 4.65 KB
/
Copy pathrelease.yml
File metadata and controls
150 lines (128 loc) 路 4.65 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
name: Pano Release
on:
push:
branches: [ "alpha", "beta", "main" ]
permissions:
contents: read
jobs:
get_next_version:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 'latest'
- name: Dry run to get next release version
id: get_next_version
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
run: |
export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'next release version is ' | awk -F"next release version is " '{print $2}')
echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT
- name: Echo new_tag_version
run: |
echo "Extracted Tag Version: ${{ steps.get_next_version.outputs.new_tag_version }}"
outputs:
new_tag_version: ${{ steps.get_next_version.outputs.new_tag_version }}
build_and_release:
runs-on: ubuntu-latest
needs: get_next_version
if: ${{ needs.get_next_version.outputs.new_tag_version != '' }}
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract branch name
id: extract_branch
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- name: Get Time
id: time
uses: nanzm/get-time-action@v1.1
with:
timeZone: 8
format: 'YYYYMMDDHHmmss'
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Download UI Releases
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
run: |
./gradlew downloadUIReleases
- name: Build
run: |
./gradlew ${{ steps.extract_branch.outputs.branch == 'main' && 'build' || 'buildDev' }} \
-PbuildType=${{ steps.extract_branch.outputs.branch == 'main' && 'release' || steps.extract_branch.outputs.branch }} \
-Pversion=${{ needs.get_next_version.outputs.new_tag_version }} \
-PtimeStamp=${{ steps.time.outputs.time }}
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: 'latest'
# Generate UI changelog from ZIP names and UI repos
- name: Generate UI changelog
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
run: |
bun ./scripts/aggregate-ui-changelog.js
if [ -f UI_CHANGELOG.md ]; then
echo "---- UI_CHANGELOG.md (preview) ----"
sed -n '1,120p' UI_CHANGELOG.md
echo "-----------------------------------"
fi
- name: Release (semantic-release)
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
run: |
npx semantic-release@24.2.6
# Append UI changelog to latest release with a Markdown separator
- name: Append UI changelog to latest release
if: success()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = 'UI_CHANGELOG.md';
if (!fs.existsSync(path)) {
core.info('UI_CHANGELOG.md not found, skipping.');
return;
}
const extraRaw = fs.readFileSync(path, 'utf8');
const extra = extraRaw.trimEnd();
if (!extra) {
core.info('UI_CHANGELOG.md empty, skipping.');
return;
}
const { owner, repo } = context.repo;
const { data: releases } = await github.rest.repos.listReleases({ owner, repo, per_page: 1 });
if (!releases.length) {
core.warning('No releases found to update.');
return;
}
const rel = releases[0];
// Use a Markdown separator to FORCE paragraph break & block context reset.
// Also add a non-breaking space paragraph to fully exit list contexts.
const separator = '\n\n \n\n---\n\n';
const base = (rel.body || '').replace(/\s+$/,''); // trim trailing ws/newlines
const newBody = base + separator + extra;
await github.rest.repos.updateRelease({
owner, repo, release_id: rel.id, body: newBody
});
core.info('Appended UI changelog with Markdown separator and spacing.');