From eec2ba63e9e22bec085467836771a80da02da344 Mon Sep 17 00:00:00 2001 From: CrowleyRajapakse Date: Mon, 12 Feb 2024 09:47:19 +0530 Subject: [PATCH] adding changes to agent release build --- .github/workflows/apim-apk-agent-release.yml | 15 +++++++++++++-- .gitignore | 2 ++ apim-apk-agent/build.gradle | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/apim-apk-agent-release.yml b/.github/workflows/apim-apk-agent-release.yml index d9615306c..6e3129b74 100644 --- a/.github/workflows/apim-apk-agent-release.yml +++ b/.github/workflows/apim-apk-agent-release.yml @@ -17,6 +17,8 @@ on: - '**/apim-apk-agent/**' branches: - 'master' +env: + GH_TOKEN: ${{ secrets.APK_BOT_TOKEN }} concurrency: group: apim-apk-agent-${{ github.event.number || github.run_id }} cancel-in-progress: true @@ -34,6 +36,14 @@ jobs: go install github.com/mgechev/revive@v1.3.4 - name: Checkout product-apim-tooling-repo uses: actions/checkout@v3 + with: + fetch-depth: "0" + token: ${{ secrets.APK_BOT_TOKEN }} + - name: Set release username and email + shell: sh + run: | + git config --global user.name ${{ secrets.APK_BOT_USER }} + git config --global user.email ${{ secrets.APK_BOT_EMAIL }} - name: checkout pull request and merge. shell: sh if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') @@ -47,7 +57,7 @@ jobs: git checkout -b apim-apk-agent-1.x git push origin apim-apk-agent-1.x cd apim-apk-agent - ./gradlew build + ./gradlew release -Prelease.useAutomaticVersion=true -Pdocker_organization=${{ secrets.DOCKER_ORGANIZATION }} -Pdocker_username=${{ secrets.DOCKER_USERNAME }} -Pdocker_password=${{ secrets.DOCKER_PASSWORD }} -Prelease.releaseVersion=${{ github.event.inputs.release_version }} -Prelease.newVersion=${{ github.event.inputs.next_version }} -PmultiArch=true -PreleaseBranch=apim-apk-agent-1.x - name: Run Gradle Build run: | cd apim-apk-agent @@ -56,7 +66,8 @@ jobs: if: github.event_name == 'pull_request_target' && github.event.action == 'closed' && github.event.pull_request.merged == true run: | cd apim-apk-agent - ./gradlew build + ./gradlew docker_push -Pdocker_organization=${{ secrets.DOCKER_ORGANIZATION }} -Pdocker_username=${{ secrets.DOCKER_USERNAME }} -Pdocker_password=${{ secrets.DOCKER_PASSWORD }} -Pimage_version=latest -PmultiArch=true + ./gradlew docker_push -Pdocker_organization=${{ secrets.DOCKER_ORGANIZATION }} -Pdocker_username=${{ secrets.DOCKER_USERNAME }} -Pdocker_password=${{ secrets.DOCKER_PASSWORD }} -Pimage_version=${{ github.sha }} -PmultiArch=true - name: run codecov uses: codecov/codecov-action@v3 with: diff --git a/.gitignore b/.gitignore index 879edeb1e..e89f5965c 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,8 @@ import-export-cli/integration/ci-resources/offset1/distribution/ # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 import-export-cli/.glide/ +apim-apk-agent/.gradle/ + import-export-cli/vendor # Sample API and App for testing diff --git a/apim-apk-agent/build.gradle b/apim-apk-agent/build.gradle index 3427b643b..d4edf5f0a 100644 --- a/apim-apk-agent/build.gradle +++ b/apim-apk-agent/build.gradle @@ -26,7 +26,7 @@ release { tagTemplate = 'apim-apk-agent-$version' git { - requireBranch= "main" + requireBranch = project.hasProperty('releaseBranch') ? project.releaseBranch : 'master' pushToRemote= "origin" } }