From 1ddf6a251e801f73c3c136fcc8677abe2bfede1a Mon Sep 17 00:00:00 2001 From: KAnggara75 Date: Sat, 19 Jul 2025 22:26:44 +0700 Subject: [PATCH] fix: overide app properties --- mavenbuild/action.yaml | 19 ++++++++++++++++--- mavenbuild/mavenbuild.sh | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/mavenbuild/action.yaml b/mavenbuild/action.yaml index d2a162c..7761d81 100644 --- a/mavenbuild/action.yaml +++ b/mavenbuild/action.yaml @@ -2,6 +2,10 @@ name: "Maven Build" description: "Build Maven Project to jar packege and upload artifact" inputs: + override-properties: + description: "Value of override properties" + default: "false" + required: false application-properties: description: "Value of application properties from secrets" required: false @@ -9,17 +13,24 @@ inputs: description: "Path of Maven Project, default ./" required: false java-version: - description: 'The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file, default `21`' + description: "The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file, default `21`" default: "21" required: false distribution: - description: 'Java distribution. See the list of supported distributions in README file, default `temurin`' + description: "Java distribution. See the list of supported distributions in README file, default `temurin`" default: "temurin" required: false + retention-days: + description: > + Duration after which artifact will expire in days. 0 means using default retention. + Minimum 1 day. + Maximum 90 days unless changed from the repository settings page. + default: "7" + required: false runs: using: "composite" - steps: + steps: - name: Using Java ${{ inputs.java-version }} ${{ inputs.distribution }} uses: actions/setup-java@v4.7.0 with: @@ -31,9 +42,11 @@ runs: env: WORK_DIR: ${{ inputs.path }} APPLICATION_PROPERTIES: ${{ inputs.application-properties }} + OVERRIDE_PROPERTIES: ${{ inputs.override-properties }} run: $GITHUB_ACTION_PATH/mavenbuild.sh - uses: actions/upload-artifact@v4 with: name: ${{ github.event.repository.name }} path: mavenbuild + retention-days: ${{ inputs.retention-days }} diff --git a/mavenbuild/mavenbuild.sh b/mavenbuild/mavenbuild.sh index 8c88b10..15e361f 100755 --- a/mavenbuild/mavenbuild.sh +++ b/mavenbuild/mavenbuild.sh @@ -11,6 +11,11 @@ override_config() { cd $WORK_DIR fi + if [[ "${OVERRIDE_PROPERTIES:-false}" != "true" ]]; then + echo "Skipping override_config karena OVERRIDE_PROPERTIES != true" + return + fi + if [[ -n "$APPLICATION_PROPERTIES" ]]; then if [[ -f src/main/resources/application.properties ]]; then echo "Rewrite application.properties"