From b95de56b248027b732f482862e8af09a6f949454 Mon Sep 17 00:00:00 2001 From: MohamedSabthar Date: Tue, 17 Oct 2023 11:18:05 +0530 Subject: [PATCH] Add step to dynamically set env variables in template workflows --- .github/workflows/build-timestamp-master-template.yml | 4 ++++ .github/workflows/central-publish-template.yml | 4 ++++ .github/workflows/pull-request-build-template.yml | 8 ++++++++ .github/workflows/release-package-template.yml | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/.github/workflows/build-timestamp-master-template.yml b/.github/workflows/build-timestamp-master-template.yml index 908f7288..8d55f692 100644 --- a/.github/workflows/build-timestamp-master-template.yml +++ b/.github/workflows/build-timestamp-master-template.yml @@ -34,6 +34,10 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Set ENV Variables + run: | + echo -e '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + "=" + .value' >> $GITHUB_ENV + - name: Build with Gradle env: packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} diff --git a/.github/workflows/central-publish-template.yml b/.github/workflows/central-publish-template.yml index 20523b23..3f96ee6b 100644 --- a/.github/workflows/central-publish-template.yml +++ b/.github/workflows/central-publish-template.yml @@ -28,6 +28,10 @@ jobs: with: distribution: "temurin" java-version: 17.0.7 + + - name: Set ENV Variables + run: | + echo -e '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + "=" + .value' >> $GITHUB_ENV - name: Build with Gradle env: diff --git a/.github/workflows/pull-request-build-template.yml b/.github/workflows/pull-request-build-template.yml index 8bd5f31c..59dbffc7 100644 --- a/.github/workflows/pull-request-build-template.yml +++ b/.github/workflows/pull-request-build-template.yml @@ -40,6 +40,10 @@ jobs: distribution: 'temurin' java-version: 17.0.7 + - name: Set ENV Variables + run: | + echo -e '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + "=" + .value' >> $GITHUB_ENV + - name: Build the Package env: packageUser: ${{ github.actor }} @@ -69,6 +73,10 @@ jobs: distribution: 'temurin' java-version: 17.0.7 + - name: Set ENV Variables + run: | + echo '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + \"=\" + .value' | Out-File -FilePath $env:GITHUB_ENV -Append + - name: Build the Project env: packageUser: ${{ github.actor }} diff --git a/.github/workflows/release-package-template.yml b/.github/workflows/release-package-template.yml index 99f1cade..2dcd8f2f 100644 --- a/.github/workflows/release-package-template.yml +++ b/.github/workflows/release-package-template.yml @@ -32,6 +32,10 @@ jobs: with: distribution: 'temurin' java-version: 17.0.7 + + - name: Set ENV Variables + run: | + echo -e '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + "=" + .value' >> $GITHUB_ENV - name: Build without Tests env: