mirror of
https://github.com/sdkman/sdkman-cli.git
synced 2026-06-07 15:27:07 -04:00
Simplify and improve build configuraton.
This commit is contained in:
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@@ -13,16 +13,14 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run tests
|
||||
run: ./gradlew clean test --info
|
||||
- name: Generate build number
|
||||
id: buildnumber
|
||||
uses: einaregilsson/build-number@v3
|
||||
with:
|
||||
token: ${{secrets.GITHUB_TOKEN}}
|
||||
- name: Set github tag
|
||||
id: vars
|
||||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
|
||||
- name: Set short git hash
|
||||
id: vars
|
||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||
- name: Build artifacts
|
||||
run: ./gradlew -Penv=production -Prelease=${{ steps.vars.outputs.tag }} -PbuildNumber=${{ steps.buildnumber.outputs.build_number }} clean assemble
|
||||
run: ./gradlew -Penv=production -Prelease=${{ steps.vars.outputs.tag }} -Phash=${{ steps.vars.outputs.sha_short }} clean assemble
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: "build/distributions/sdkman-cli-*.zip"
|
||||
|
||||
38
build.gradle
38
build.gradle
@@ -11,30 +11,23 @@ ext.installBinDir = "${userHome}/.sdkman/bin"
|
||||
ext.installSrcDir = "${userHome}/.sdkman/src"
|
||||
ext.installContribDir = "${userHome}/.sdkman/contrib"
|
||||
|
||||
def loadConfiguration() {
|
||||
def environment = hasProperty('env') ? env : 'local'
|
||||
ext.environment = environment
|
||||
println("Environment is set to: ${environment}")
|
||||
ext.environment = hasProperty('env') ? env : 'local'
|
||||
ext.hash = hasProperty('hash') ? hash : 'hash'
|
||||
ext.release = hasProperty('release') ? release : 'master'
|
||||
ext.candidatesApi = ext.environment == 'production' ? 'https://api.sdkman.io/2' : 'http://localhost:8080/2'
|
||||
|
||||
def buildNumber = hasProperty('buildNumber') ? buildNumber : '0'
|
||||
ext.buildNumber = buildNumber
|
||||
println("Build number set to: ${buildNumber}")
|
||||
ext.sdkmanVersion = ext.release == 'master' ? "master+${ext.hash}".toString() : ext.release
|
||||
|
||||
def release = hasProperty('release') ? release : 'master'
|
||||
ext.release = release
|
||||
println("Release set to: ${release}")
|
||||
println("Environment is set to: $environment")
|
||||
println("Short git hash: $hash")
|
||||
println("Release set to: $release")
|
||||
println("Candidtes API: $candidatesApi")
|
||||
println("Version: $sdkmanVersion")
|
||||
|
||||
def configFile = file('config.groovy')
|
||||
def config = new ConfigSlurper(environment).parse(configFile.toURI().toURL())
|
||||
ext.config = config
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
loadConfiguration()
|
||||
|
||||
ext.sdkmanCliBuildVersion = ext.release == 'master' ? "master+${buildNumber}".toString() : ext.release
|
||||
|
||||
repositories.jcenter()
|
||||
|
||||
dependencies {
|
||||
testImplementation('com.github.tomakehurst:wiremock:2.25.1') {
|
||||
exclude(module: 'junit')
|
||||
@@ -60,8 +53,8 @@ task prepareScripts(type: Copy) {
|
||||
filter(
|
||||
ReplaceTokens,
|
||||
tokens: [
|
||||
SDKMAN_VERSION : sdkmanCliBuildVersion,
|
||||
SDKMAN_CANDIDATES_API: config.candidatesApi
|
||||
SDKMAN_VERSION : sdkmanVersion,
|
||||
SDKMAN_CANDIDATES_API: candidatesApi
|
||||
]
|
||||
)
|
||||
}
|
||||
@@ -77,8 +70,7 @@ tasks.test.configure {
|
||||
}
|
||||
|
||||
task assembleArchive(type: Zip, dependsOn: [prepareScripts, prepareContrib]) {
|
||||
archiveAppendix = 'cli'
|
||||
archiveVersion = sdkmanCliBuildVersion
|
||||
archiveVersion = sdkmanVersion
|
||||
from('build/scripts') {
|
||||
include('*.sh*')
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
sdkmanCliVersion = 'master'
|
||||
environments {
|
||||
local {
|
||||
candidatesApi = 'http://localhost:8080/2'
|
||||
}
|
||||
production {
|
||||
candidatesApi = 'https://api.sdkman.io/2'
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user