-
Notifications
You must be signed in to change notification settings - Fork 26
87 lines (79 loc) · 3.46 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
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: "['email', 'http', 'websocket']"
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
- 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 mime module version
run: |
if ${{ inputs.timestamped_version != ''}}; then
MIME_VERSION=${{ inputs.timestamped_version }}
else
MIME_VERSION=${{ env.TIME_STAMPED_VERSION }}
fi
echo MIMEVERSION=$MIME_VERSION
sed -i "s/stdlibMimeVersion=\(.*\)/stdlibMimeVersion=$MIME_VERSION/g" gradle.properties
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew clean build