Enforcer fat jar #627
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Enforcer. | |
on: | |
workflow_call: | |
inputs: | |
aks_deployment: | |
required: true | |
type: boolean | |
description: "Deploy to AKS" | |
secrets: | |
APK_BOT_TOKEN: | |
required: true | |
APK_BOT_USER: | |
required: true | |
APK_BOT_EMAIL: | |
required: true | |
DOCKER_ORGANIZATION: | |
required: true | |
AZURE_ACR_NAME: | |
required: true | |
AZURE_CREDENTIALS: | |
required: true | |
workflow_dispatch: | |
inputs: | |
release_version: | |
required: true | |
type: string | |
description: "Release Version" | |
next_version: | |
type: string | |
description: "Next Development Version" | |
pull_request_target: | |
types: | |
- closed | |
paths: | |
- '**/gateway/enforcer/**' | |
branches: | |
- 'main' | |
env: | |
GH_TOKEN: ${{ secrets.APK_BOT_TOKEN }} | |
NEXUS_REPO_URL: ${{ secrets.NEXUS_REPO_URL }} | |
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | |
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | |
concurrency: | |
group: enforcer-${{ github.event.number || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Checkout apk-repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: "0" | |
path: apk-repo | |
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') | |
run: | | |
cd apk-repo | |
gh pr checkout ${{ github.event.number }} -b pr-${{ github.event.number }} | |
git checkout pr-${{ github.event.number }} | |
git merge origin/main | |
- name: Run Release Gradle build | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '' && github.event.inputs.next_version != '' | |
run: | | |
cd apk-repo | |
git checkout -b enforcer-1.x | |
git push origin enforcer-1.x | |
cd gateway/enforcer | |
./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=enforcer-1.x | |
- name: Run Gradle Build | |
run: | | |
cd apk-repo/gateway/enforcer | |
./gradlew build | |
- name: Run Gradle Build | |
if: github.event_name == 'pull_request_target' && github.event.action == 'closed' && github.event.pull_request.merged == true | |
run: | | |
cd apk-repo/gateway/enforcer | |
./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: Login to azure. | |
if: ${{inputs.aks_deployment}} | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Push Docker images to aks. | |
if: ${{inputs.aks_deployment}} | |
run: | | |
az acr login -n ${{ secrets.AZURE_ACR_NAME }} | |
cd apk-repo/gateway/enforcer | |
./gradlew docker_push -Pdocker_organization=${{ secrets.DOCKER_ORGANIZATION }} -Pimage_version=${{ github.sha }} -PmultiArch=true | |
- name: run codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
verbose: true # optional (default = false) | |
directory: apk-repo/gateway/enforcer | |
flags: enforcer | |