Skip to content

Commit b3419a4

Browse files
committed
[skip ci] attempting to fix secret resolution
1 parent d949629 commit b3419a4

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Release
22
on:
33
release:
4-
types: [published]
4+
types: [ published ]
55
env:
66
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77
JAVA_VERSION: '17.0.15' # this must be a specific version for reproducible builds
@@ -49,13 +49,18 @@ jobs:
4949
uses: grails/github-actions/pre-release@asf
5050
env:
5151
RELEASE_VERSION: ${{ steps.release_version.outputs.value }}
52-
- name: "🧩 Run Assemble"
53-
id: assemble
54-
run: ./gradlew -U assemble
5552
- name: "🔐 Generate key file for artifact signing"
5653
env:
5754
SECRING_FILE: ${{ secrets.SECRING_FILE }}
5855
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg
56+
- name: "🧩 Run Assemble"
57+
id: assemble
58+
run: |
59+
./gradlew -U assemble -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg
60+
env:
61+
GRAILS_PUBLISH_RELEASE: 'true'
62+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
63+
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
5964
- name: "📤 Publish to Maven Central"
6065
env:
6166
GRAILS_PUBLISH_RELEASE: 'true'

build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import java.time.Instant
2+
import java.time.ZoneOffset
3+
import java.time.format.DateTimeFormatter
4+
15
version = projectVersion
26
group = 'org.grails.plugins'
37

@@ -17,6 +21,16 @@ repositories {
1721
}
1822
}
1923

24+
ext {
25+
buildInstant = java.util.Optional.ofNullable(System.getenv("SOURCE_DATE_EPOCH"))
26+
.filter(s -> !s.isEmpty())
27+
.map(Long::parseLong)
28+
.map(Instant::ofEpochSecond)
29+
.orElseGet(Instant::now)
30+
formattedBuildDate = DateTimeFormatter.ISO_INSTANT.format(buildInstant)
31+
buildDate = (buildInstant as Instant).atZone(ZoneOffset.UTC) // for reproducible builds
32+
}
33+
2034
dependencies {
2135

2236
compileOnly platform("org.apache.grails:grails-bom:$grailsVersion")

settings.gradle

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,29 @@ plugins {
55

66
def isCI = System.getenv().containsKey('CI')
77
def isLocal = !isCI
8-
def isAuthenticated = System.getenv().containsKey('DEVELOCITY_ACCESS_KEY')
8+
def isReproducibleBuild = System.getenv('SOURCE_DATE_EPOCH') != null
9+
if (isReproducibleBuild) {
10+
gradle.settingsEvaluated {
11+
logger.warn('*************** Remote Build Cache Disabled due to Reproducible Build ********************')
12+
logger.warn("Build date will be set to (SOURCE_DATE_EPOCH=${System.getenv("SOURCE_DATE_EPOCH")})")
13+
}
14+
}
915

1016
develocity {
1117
server = 'https://ge.grails.org'
1218
buildScan {
1319
tag('grails-plugins')
1420
tag('grails-mail')
15-
publishing.onlyIf { isAuthenticated }
21+
publishing.onlyIf { it.authenticated }
1622
uploadInBackground = isLocal
1723
}
1824
}
1925

2026
buildCache {
21-
local { enabled = isLocal }
27+
local { enabled = (isLocal && !isReproducibleBuild) || (isCI && isReproducibleBuild) }
2228
remote(develocity.buildCache) {
23-
push = isCI && isAuthenticated
24-
enabled = true
29+
push = isCI
30+
enabled = !isReproducibleBuild
2531
}
2632
}
2733

0 commit comments

Comments
 (0)