From b2e58a66624b982519f5553f482b86e9870f4c46 Mon Sep 17 00:00:00 2001 From: Benjamin Wolf Date: Wed, 1 Mar 2023 17:05:51 +0100 Subject: [PATCH] Simplify release generation The release version is now extracted from the tag name. --- .github/workflows/build_main.yml | 18 +++++++++++------- .github/workflows/build_pr.yml | 5 ++--- .github/workflows/build_releasecandidate.yml | 16 ++++++++++------ build.gradle | 12 +++++++----- document.version | 1 - 5 files changed, 30 insertions(+), 22 deletions(-) delete mode 100644 document.version diff --git a/.github/workflows/build_main.yml b/.github/workflows/build_main.yml index 7907af9..42d2277 100644 --- a/.github/workflows/build_main.yml +++ b/.github/workflows/build_main.yml @@ -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: | diff --git a/.github/workflows/build_pr.yml b/.github/workflows/build_pr.yml index 337fb5c..aedf68b 100644 --- a/.github/workflows/build_pr.yml +++ b/.github/workflows/build_pr.yml @@ -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 diff --git a/.github/workflows/build_releasecandidate.yml b/.github/workflows/build_releasecandidate.yml index b0194ba..005b42d 100644 --- a/.github/workflows/build_releasecandidate.yml +++ b/.github/workflows/build_releasecandidate.yml @@ -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: | diff --git a/build.gradle b/build.gradle index 4198fc7..180cb74 100644 --- a/build.gradle +++ b/build.gradle @@ -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"]) { @@ -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 { @@ -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', @@ -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") } diff --git a/document.version b/document.version deleted file mode 100644 index dfee34e..0000000 --- a/document.version +++ /dev/null @@ -1 +0,0 @@ -2023.1-RC1