Skip to content

Commit

Permalink
Simplify release generation
Browse files Browse the repository at this point in the history
The release version is now extracted from the tag name.
  • Loading branch information
programming-wolf committed Mar 1, 2023
1 parent 914c5dd commit b2e58a6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/build_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
- name: Execute Gradle Build
uses: eskatos/gradle-command-action@v2
with:
# Gradle command line arguments, see gradle --help
gradle-version: 7.5.1
arguments: buildDocs

# do the following two things only for a release!
# If we're building a release, we need to set the variable RELEASE_VERSION
- name: Set Environment Variables for Release Version
if: startsWith(github.ref, 'refs/tags/')
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV

- name: Execute Gradle Build
uses: gradle/gradle-build-action@v2
env:
CI: true
with:
gradle-version: wrapper
arguments: buildDocs

# release and deploy only if we're building a release
- name: Prepare Deployment
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ jobs:
distribution: 'temurin'
java-version: 17
- name: Execute Gradle Build
uses: eskatos/gradle-command-action@v2
uses: gradle/gradle-build-action@v2
with:
# Gradle command line arguments, see gradle --help
gradle-version: 7.5.1
gradle-version: wrapper
arguments: buildDocs
16 changes: 10 additions & 6 deletions .github/workflows/build_releasecandidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,21 @@ jobs:
with:
distribution: 'temurin'
java-version: 17

# If we're building a release, we need to set the variable RELEASE_VERSION
- name: Set Environment Variables for Release Version
if: startsWith(github.ref, 'refs/tags/')
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV

- name: Execute Gradle Build
uses: eskatos/gradle-command-action@v2
uses: gradle/gradle-build-action@v2
env:
CI: true
with:
# Gradle command line arguments, see gradle --help
gradle-version: 7.5.1
gradle-version: wrapper
arguments: buildDocs

# do the following two things only for a release!
- name: Set Environment Variables for Release Version
if: startsWith(github.ref, 'refs/tags/')
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Prepare Deployment
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand Down
12 changes: 7 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ ext {
today = new Date()
versionDate = new SimpleDateFormat("yyyyMMdd").format(today)

project.version = project.file("./document.version").text
releaseVersion = System.getenv("RELEASE_VERSION")
localVersion = "LocalBuild"
project.version = releaseVersion == null ? localVersion : releaseVersion;

curriculumFileName = "curriculum-ddd"
addSuffixToCurriculum = { suffix ->
for (extension in ["html", "pdf"]) {
Expand All @@ -35,7 +38,7 @@ ext {

class RenderCurriculumTask extends AsciidoctorTask {
@Inject
RenderCurriculumTask(WorkerExecutor we, String curriculumFileName, String versionDate, String language, boolean withRemarks) {
RenderCurriculumTask(WorkerExecutor we, String curriculumFileName, String versionDate, String language) {
super(we)

forkOptions {
Expand Down Expand Up @@ -65,7 +68,6 @@ class RenderCurriculumTask extends AsciidoctorTask {
'document-version' : fileVersion + "-" + versionDate,
'currentDate' : versionDate,
'language' : language,
'withRemarks' : withRemarks,
'curriculumFileName': curriculumFileName,
'debug_adoc' : false,
'pdf-stylesdir' : '../pdf-theme/themes',
Expand All @@ -84,14 +86,14 @@ task buildDocs {
}

task renderDE(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "DE", false]) {
constructorArgs: [curriculumFileName, versionDate, "DE"]) {
doLast {
addSuffixToCurriculum("-de")
}
}

task renderEN(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "EN", false]) {
constructorArgs: [curriculumFileName, versionDate, "EN"]) {
doLast {
addSuffixToCurriculum("-en")
}
Expand Down
1 change: 0 additions & 1 deletion document.version

This file was deleted.

0 comments on commit b2e58a6

Please sign in to comment.