This message was deleted.
# community-support
s
This message was deleted.
e
substitution is something the Spring framework does when reading its configuration for example. it is not a feature of properties files.
c
right, I think I've seen something else that does it though too (maven?). The question is whether gradle supports it. I'm guessing from your answer, the answer is no
s
You can set arbitrary Gradle properties via environment variables by prefixing the environment variable name with
ORG_GRADLE_PROJECT_
. So
export ORG_GRADLE_PROJECT_foo=bar
sets the
foo
Gradle property to
bar
.
c
yeah, but I was trying to avoid the value being on the cli, credentials, see previous rant (dear gh, why you putting them in the env), neways... might as well just access the env vars in the kts...
I mean, I guess I could... do it that way because it'd be ORG_GRADLE_PROJECT... = GH..
probably makes my build more verbose than is beneficial though
s
Are you talking about GH workflows? I simply do e.g.
Copy code
env:
          ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
there.
c
yeah, definitely an option, in this case I'm (at least starting) publishing to githubs own package repo stuff, which uses
Copy code
username = System.getenv("GITHUB_ACTOR")
        password = System.getenv("GITHUB_TOKEN")
I guess it's a question of "which file"...
lol
e
no reason to actually use their publishing template
Copy code
publishing {
    repositories {
        maven("<https://maven.pkg.github.com/foo/bar|https://maven.pkg.github.com/foo/bar>") {
            name = "GitHubPackages"
           credentials(PasswordCredentials::class)
        }
    }
}
Copy code
env:
  ORG_GRADLE_PROJECT_GitHubPackagesUsername: ${{ github.actor }}
  ORG_GRADLE_PROJECT_GitHubPackagesPassword: ${{ secrets.GITHUB_TOKEN }}
c
right, but is that better for some reason?
Not trying to argue just kind of on the fence and trying to think about whether one is better than the other for some reason or another