-
Notifications
You must be signed in to change notification settings - Fork 94
126 lines (124 loc) · 4.83 KB
/
idp-domain-service-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Release IDP Domain Service Release.
on:
workflow_call:
inputs:
aks_deployment:
required: true
type: boolean
description: "Deploy to AKS"
secrets:
WSO2_BOT_TOKEN:
required: true
WSO2_BOT_USER:
required: true
WSO2_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
- opened
- synchronize
paths:
- '**/idp/idp-domain-service/**'
branches:
- 'main'
concurrency:
group: idp-domain-service-${{ github.event.number || github.run_id }}
cancel-in-progress: true
env:
GH_TOKEN: ${{ secrets.WSO2_BOT_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Ballerina.
uses: actions/cache@v3
id: cache
with:
path: "ballerina-dist/*.deb"
key: "ballerina-2201.8.0"
- name: Download Ballerina distribution.
shell: sh
run: |
mkdir -p ballerina-dist
wget 'https://dist.ballerina.io/downloads/2201.8.0/ballerina-2201.8.0-swan-lake-linux-x64.deb' -P ballerina-dist
if: steps.cache.outputs.cache-hit != 'true'
- name: Install Ballerina distribution.
shell: sh
run: "sudo dpkg -i ballerina-dist/ballerina-2201.8.0-swan-lake-linux-x64.deb"
- name: Verify Ballerina Version
shell: sh
run: "bal -v"
- name: Checkout apk-repo.
uses: actions/checkout@v3
with:
fetch-depth: "0"
path: apk-repo
token: ${{ secrets.WSO2_BOT_TOKEN }}
- name: Set release username and email
shell: sh
run: |
git config --global user.name ${{ secrets.WSO2_BOT_USER }}
git config --global user.email ${{ secrets.WSO2_BOT_EMAIL }}
- name: checkout pull request and merge.
shell: sh
if: github.event_name == 'pull_request_target' && github.event.action == 'opened' || github.event.action == 'synchronize'
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 Gradle build
if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '' && github.event.inputs.next_version != ''
shell: sh
run: |
cd apk-repo/idp/idp-domain-service
./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
./gradlew :ballerina:commit_toml_files
- name: Run Gradle Build
run: |
cd apk-repo/idp/idp-domain-service
./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/idp/idp-domain-service
./gradlew docker:docker_push -Pdocker_organization=${{ secrets.DOCKER_ORGANIZATION }} -Pdocker_username=${{ secrets.DOCKER_USERNAME }} -Pdocker_password=${{ secrets.DOCKER_PASSWORD }} -Pimage_version=latest -PmultiArch=true
./gradlew docker: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/idp/idp-domain-service
./gradlew docker: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/idp/idp-domain-service
flags: idp-domain-service