-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (85 loc) · 2.75 KB
/
Copy pathrelease.yml
File metadata and controls
98 lines (85 loc) · 2.75 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
name: Release build
# Builds every branch listed in .github/branches.json and attaches the jars
# declared in .github/publish.json to the release.
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: Release tag to build and attach jars to
type: string
required: true
concurrency:
group: release-${{ github.event.release.tag_name || inputs.tag }}
cancel-in-progress: false
permissions:
contents: write
jobs:
discover:
name: Discover version branches
uses: ./.github/workflows/discover.yml
build:
name: Build ${{ matrix.entry.branch }}
needs: discover
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
entry: ${{ fromJSON(needs.discover.outputs.branches) }}
steps:
- name: Checkout ${{ matrix.entry.branch }}
uses: actions/checkout@v4
with:
ref: ${{ matrix.entry.branch }}
- name: Checkout CI config
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
path: .ci
sparse-checkout: .github
- name: Set up JDK ${{ matrix.entry.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.entry.java }}
distribution: ${{ matrix.entry.java_distribution }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build
env:
GRADLE_TASK: ${{ matrix.entry.gradle_task }}
GRADLE_ARGS: ${{ matrix.entry.gradle_args }}
run: |
set -euo pipefail
chmod +x ./gradlew
# shellcheck disable=SC2086 -- gradle_args is a word-split argument list
./gradlew "$GRADLE_TASK" $GRADLE_ARGS --stacktrace
- name: Collect release jars
id: collect
env:
BRANCH: ${{ matrix.entry.branch }}
run: |
python3 .ci/.github/scripts/modci.py collect \
--config .ci/.github/publish.json \
--root . \
--out release-assets \
--label "$BRANCH"
- name: Upload jars to the release
if: steps.collect.outputs.found == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.release.tag_name || inputs.tag }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
gh release upload "$TAG" release-assets/*.jar --repo "$REPO" --clobber
- name: Upload build artifacts (traceability)
if: steps.collect.outputs.found == 'true'
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.entry.safe }}
path: release-assets/*.jar
retention-days: 14
if-no-files-found: error