Skip to content

Commit fcf33ce

Browse files
committed
chore: start working on release job
1 parent 11f371e commit fcf33ce

File tree

5 files changed

+116
-3
lines changed

5 files changed

+116
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: "ci_checks"
3-
"on":
3+
on:
44
pull_request: null
55
push:
66
branches:

.github/workflows/gradle-wrapper-validation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: "Validate Gradle Wrapper"
23

34
on:

.github/workflows/publish.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
name: "publish a release"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
force_version:
8+
description: "Force version number to publish (empty for automatic semver versioning)"
9+
required: false
10+
default: ""
11+
to_publish: #TODO
12+
description: "What to publish"
13+
required: true
14+
default: "all"
15+
type: choice
16+
options:
17+
- plugin-gradle
18+
- plugin-maven
19+
- all
20+
- lib
21+
22+
permissions:
23+
contents: write
24+
25+
concurrency:
26+
group: "${{ github.workflow }}-${{ github.ref }}"
27+
cancel-in-progress: true
28+
jobs:
29+
nativeCompile:
30+
name: "${{ matrix.platform.name }}: create production-binary"
31+
strategy:
32+
matrix:
33+
platform:
34+
- name: "linux-x86_64"
35+
runner: "ubuntu-latest"
36+
- name: "linux-aarch64"
37+
runner: "ubuntu-24.04-arm"
38+
- name: "windows-x86_64"
39+
runner: "windows-latest"
40+
- name: "macos-aaarch64"
41+
runner: "macos-latest"
42+
- name: "macos-x86_64"
43+
runner: "macos-13"
44+
runs-on: "${{ matrix.platform.runner }}"
45+
env:
46+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: "15"
47+
steps:
48+
- name: "Checkout"
49+
uses: "actions/checkout@v4"
50+
with:
51+
fetch-depth: 0
52+
- name: "Install JDK 21"
53+
uses: "actions/setup-java@v4"
54+
with:
55+
distribution: "graalvm"
56+
java-version: 21
57+
- name: "Install Node.js"
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: "lts/jod" # 22
61+
- name: "Setup Gradle"
62+
uses: "gradle/actions/setup-gradle@v4"
63+
- name: "Run nativeCompile"
64+
run: "./gradlew -Prelease=true nativeCompile"
65+
- name: "upload binary" # for collecting later
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: "${{ env.RUN_UNIQUE_ID }}-native-binary-${{ matrix.platform.name }}"
69+
path: app/build/native/nativeCompile/spotless
70+
retention-days: 1
71+
if-no-files-found: "error"
72+
createRelease:
73+
needs: nativeCompile
74+
name: "Create a new release"
75+
runs-on: ubuntu-latest
76+
env:
77+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: "15"
78+
steps:
79+
- name: "Checkout"
80+
uses: actions/checkout@v4
81+
with:
82+
fetch-depth: 0
83+
- name: "Install JDK 21"
84+
uses: "actions/setup-java@v4"
85+
with:
86+
distribution: "graalvm"
87+
java-version: 21
88+
- name: "Setup Gradle"
89+
uses: "gradle/actions/setup-gradle@v4"
90+
- name: "Retrieve production-binaries"
91+
uses: "actions/download-artifact@v4"
92+
with:
93+
# no name - download all artifacts
94+
path: "app/build/collected-binaries"
95+
- name: Display structure of downloaded files
96+
run: "ls -R app/build/collected-binaries"

build-logic/src/main/groovy/buildlogic.changelog-conventions.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,19 @@ plugins {
33
}
44

55
spotlessChangelog {
6+
// need -Prelease=true in order to do a publish
67
appendDashSnapshotUnless_dashPrelease=true
8+
9+
if (project.hasProperty('releaseForceVersion') && project.releaseForceVersion != '') {
10+
forceNextVersion = project.releaseForceVersion
11+
}
12+
tagMessage "{{changes}}"
13+
// https://cli.github.com/manual/gh_release_create
14+
runAfterPush "gh release create {{version}} --title 'spotless-cli v{{version}}' --notes-from-tag ${releaseBinaries().join(' ')}"
715
}
816

917
version = spotlessChangelog.versionNext
18+
19+
List<String> releaseBinaries() {
20+
return [""] // TODO implement
21+
}

build-logic/src/main/groovy/buildlogic.java-graalvm-conventions.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ graalvmNative {
4444

4545
// allow calling prettier (using local http server)
4646
buildArgs.add('--enable-url-protocols=http')
47-
// optimizations, see https://www.graalvm.org/latest/reference-manual/native-image/optimizations-and-performance/
48-
//buildArgs.add('-O3') // on production builds
4947

48+
if (project.hasProperty('release') && project.release == 'true') {
49+
// optimizations, see https://www.graalvm.org/latest/reference-manual/native-image/optimizations-and-performance/
50+
buildArgs.add('-O3') // on production builds: Aims for the best performance at the cost of longer build times.
51+
} else {
52+
buildArgs.add('-Ob') // Quick build mode
53+
}
5054
// the following options are required for GJF
5155
// see: <https://github.com/google/google-java-format/issues/894#issuecomment-1430408909>
5256
buildArgs.add('-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED')

0 commit comments

Comments
 (0)