-
Notifications
You must be signed in to change notification settings - Fork 85
159 lines (145 loc) · 6.6 KB
/
build-dependent-std-libs.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Build Dependent Standard Libraries
on:
workflow_dispatch:
inputs:
timestamped_version:
description: Module timestamped version
required: false
default: ''
target_branch:
description: Target branch of the dependent module
required: false
default: ''
ballerina_modules:
description: Dependent Ballerina modules
required: false
default: "['grpc', 'websocket', 'websub', 'websubhub', 'graphql', 'sql']"
ballerinax_modules:
description: Dependent Ballerina extended modules
required: false
default: "['rabbitmq', 'kafka']"
jobs:
build-ballerina-modules:
if: inputs.ballerina_modules != ''
name: Build Ballerina Module
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: ${{ fromJson(inputs.ballerina_modules) }}
steps:
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 21.0.3
- name: Checkout module
uses: actions/checkout@v3
if: ${{ inputs.timestamped_version == '' }}
- name: Change to Timestamped Version
if: ${{ inputs.timestamped_version == '' }}
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
latestCommit=$(git log -n 1 --pretty=format:"%h")
VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
updatedVersion=$VERSION-$startTime-$latestCommit
echo TIME_STAMPED_VERSION=$updatedVersion
echo TIME_STAMPED_VERSION=$updatedVersion >> $GITHUB_ENV
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Build Timestamped version
if: ${{ inputs.timestamped_version == '' }}
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew clean build publishToMavenLocal -x test
- name: Checkout dependent Ballerina module
uses: actions/checkout@v3
id: checkout
if: ${{ inputs.target_branch != '' }}
continue-on-error: true
with:
repository: 'ballerina-platform/module-ballerina-${{ matrix.module }}'
ref: ${{ inputs.target_branch }}
- name: Checkout default branch
uses: actions/checkout@v3
if: ${{ inputs.target_branch == '' || steps.checkout.outcome == 'failure' }}
continue-on-error: true
with:
repository: 'ballerina-platform/module-ballerina-${{ matrix.module }}'
- name: Change http module version
run: |
if ${{ inputs.timestamped_version != ''}}; then
HTTP_VERSION=${{ inputs.timestamped_version }}
else
HTTP_VERSION=${{ env.TIME_STAMPED_VERSION }}
fi
echo HTTPVERSION=$HTTP_VERSION
sed -i "s/stdlibHttpVersion=\(.*\)/stdlibHttpVersion=$HTTP_VERSION/g" gradle.properties
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew clean build
build-ballerinax-modules:
if: inputs.ballerinax_modules != ''
name: Build Ballerina Extended Module
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: ${{ fromJson(inputs.ballerinax_modules) }}
steps:
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 21.0.3
- name: Checkout module
uses: actions/checkout@v3
if: ${{ inputs.timestamped_version == '' }}
- name: Change to Timestamped Version
if: ${{ inputs.timestamped_version == '' }}
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
latestCommit=$(git log -n 1 --pretty=format:"%h")
VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
updatedVersion=$VERSION-$startTime-$latestCommit
echo TIME_STAMPED_VERSION=$updatedVersion
echo TIME_STAMPED_VERSION=$updatedVersion >> $GITHUB_ENV
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Build Timestamped version
if: ${{ inputs.timestamped_version == '' }}
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew clean build publishToMavenLocal -x test
- name: Checkout dependent Ballerina extended module
uses: actions/checkout@v3
id: checkout
if: ${{ inputs.target_branch != '' }}
continue-on-error: true
with:
repository: 'ballerina-platform/module-ballerinax-${{ matrix.module }}'
ref: ${{ inputs.target_branch }}
- name: Checkout default branch
uses: actions/checkout@v3
if: ${{ inputs.target_branch == '' || steps.checkout.outcome == 'failure' }}
continue-on-error: true
with:
repository: 'ballerina-platform/module-ballerinax-${{ matrix.module }}'
- name: Change http module version
run: |
if ${{ inputs.timestamped_version != ''}}; then
HTTP_VERSION=${{ inputs.timestamped_version }}
else
HTTP_VERSION=${{ env.TIME_STAMPED_VERSION }}
fi
echo HTTPVERSION=$HTTP_VERSION
sed -i "s/stdlibHttpVersion=\(.*\)/stdlibHttpVersion=$HTTP_VERSION/g" gradle.properties
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew clean build