-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (168 loc) · 6.46 KB
/
ci.yml
File metadata and controls
198 lines (168 loc) · 6.46 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Continuous Integration
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
build-release:
name: Release Build (Java 21 canonical)
runs-on: ubuntu-latest
outputs:
dist-files: ${{ steps.collect-dist-files.outputs.files }}
timestamp: ${{ steps.timestamp.outputs.timestamp }}
steps:
- name: Set Timestamp
id: timestamp
run: echo "timestamp=$(date +"%Y%m%d%H%M%S")" >> "$GITHUB_OUTPUT"
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Set up Java 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
with:
distribution: temurin
java-version: '21'
cache: gradle
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@748248ddd2a24f49513d8f472f81c3a07d4d50e1
- name: Release Build
env:
SONATYPE_BEARER: ${{ secrets.SONATYPE_BEARER }}
GITHUB_BEARER: ${{ secrets.GH_PAT_public_read_example_pde_rcp_2026 }}
run: |
./gradlew --version
./gradlew --no-daemon clean build testOSGi release
- name: Collect dist file list
id: collect-dist-files
shell: bash
run: |
files_json=$(find ./dist/bundles -type f -name "*.jar" ! -name "*-javadoc*.jar" ! -name "*-sources*.jar" | sort | jq -R -s -c 'split("\n")[:-1]')
echo "files=${files_json}" >> "$GITHUB_OUTPUT"
echo -e "\n#\n# Collected canonical dist files:\n#\n"
if [ "${files_json}" = "[]" ]; then
echo " - none"
else
echo "$files_json" | jq -r '.[]' | while read file; do
echo " - $file"
done
fi
- name: Upload dist bundle (internal)
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
with:
name: dist-bundle-${{ github.event.repository.name }}-${{ steps.timestamp.outputs.timestamp }}
path: |
./dist/bundles/**/*.jar
!./dist/bundles/**/*-javadoc*.jar
!./dist/bundles/**/*-sources*.jar
if-no-files-found: error
upload-dist-files:
name: Upload canonical dist files
runs-on: ubuntu-latest
needs:
- build-release
if: ${{ needs.build-release.outputs.dist-files != '[]' }}
strategy:
fail-fast: false
matrix:
file: ${{ fromJson(needs.build-release.outputs.dist-files) }}
steps:
- name: Download dist bundle
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: dist-bundle-${{ github.event.repository.name }}-${{ needs.build-release.outputs.timestamp }}
path: .
- name: Compute artifact name
id: artifact-name
shell: bash
run: |
file="${{ matrix.file }}"
name="$(basename "${file}")"
timestamp="${{ steps.build-release.outputs.timestamp }}"
echo "name=${name%.jar}-${timestamp}" >> "$GITHUB_OUTPUT"
- name: Resolve downloaded file path
id: resolve-file
shell: bash
run: |
original="${{ matrix.file }}"
candidate1="${original#./}"
candidate2="${original#./dist/bundles/}"
if [ -f "${original}" ]; then
resolved="${original}"
elif [ -f "${candidate1}" ]; then
resolved="${candidate1}"
elif [ -f "${candidate2}" ]; then
resolved="${candidate2}"
else
echo "Could not resolve downloaded file for matrix entry: ${original}"
echo "Top-level files for debugging:"
find . -maxdepth 6 -type f | sort
exit 1
fi
echo "path=${resolved}" >> "$GITHUB_OUTPUT"
- name: Upload ${{ matrix.file }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
with:
name: ${{ steps.artifact-name.outputs.name }}
path: ${{ steps.resolve-file.outputs.path }}
if-no-files-found: error
build-java25:
name: Build Verification (Java 25)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Set up Java 25
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
with:
distribution: temurin
java-version: '25'
cache: gradle
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@748248ddd2a24f49513d8f472f81c3a07d4d50e1
- name: Build (no artifact upload)
env:
GITHUB_BEARER: ${{ secrets.GH_PAT_public_read_example_pde_rcp_2026 }}
run: ./gradlew --no-daemon clean build
publish-latest-main:
name: Publish latest-main release
runs-on: ubuntu-latest
needs:
- build-release
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Download dist bundle
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: dist-bundle-${{ github.event.repository.name }}-${{ needs.build-release.outputs.timestamp }}
path: .
- name: Create or update latest-main release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
shell: bash
run: |
mapfile -t JARS < <(find dist/bundles -name "*.jar" \
! -name "*-javadoc*.jar" \
! -name "*-sources*.jar" \
-type f | sort)
if [ ${#JARS[@]} -eq 0 ]; then
echo "No JAR files found – skipping release update."
exit 0
fi
echo "Artifacts to publish:"
printf ' %s\n' "${JARS[@]}"
gh release delete latest-main --yes --cleanup-tag 2>/dev/null || true
printf 'Automatically updated on every successful build of the `main` branch.\n\nCommit: [`%s`](https://github.com/%s/commit/%s)\n' \
"${GITHUB_SHA:0:12}" "${GITHUB_REPOSITORY}" "${GITHUB_SHA}" > /tmp/release-notes.md
gh release create latest-main \
--title "Latest main branch build" \
--notes-file /tmp/release-notes.md \
--prerelease \
--target "${GITHUB_SHA}" \
"${JARS[@]}"