-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
62 lines (60 loc) · 2.41 KB
/
action.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
name: 'Setup Ballerina'
description: 'Install Ballerina `bal` command'
branding:
icon: 'archive'
color: 'green'
inputs:
version:
description: "Ballerina Version"
required: true
default: 2201.1.0
runs:
using: "composite"
steps:
- name: Cache Restore
id: cache-dist
uses: actions/cache@v3
with:
path: |
ballerina-${{ inputs.version }}-*.*
key: ballerina-${{ inputs.version }}-${{ runner.os }}
- name: Download Ballerina installer
if: steps.cache-dist.outputs.cache-hit != 'true'
run: |
set -x
if [[ $OSTYPE == 'msys'* ]]; then
echo "windows runner detected"
curl -L -S -s https://dist.ballerina.io/downloads/${{ inputs.version }}/ballerina-${{ inputs.version }}-swan-lake-windows-x64.msi --output ballerina-${{ inputs.version }}-swan-lake-windows-x64.msi
elif [[ $OSTYPE == 'darwin'* ]]; then
echo "macos runner detected"
wget -q https://dist.ballerina.io/downloads/${{ inputs.version }}/ballerina-${{ inputs.version }}-swan-lake-macos-x64.pkg
else
echo "ubuntu runner detected"
wget -q https://dist.ballerina.io/downloads/${{ inputs.version }}/ballerina-${{ inputs.version }}-swan-lake-linux-x64.deb
fi
shell: bash
- name: Install Ballerina
run: |
set -x
if [[ $OSTYPE == 'msys'* ]]; then
echo "windows runner detected"
msiexec //i ballerina-${{ inputs.version }}-swan-lake-windows-x64.msi //qn
echo "BALLERINA_HOME=C:\\Program Files\\Ballerina\\" >> $GITHUB_ENV
powershell ${GITHUB_ACTION_PATH}/updatepath.ps1
elif [[ $OSTYPE == 'darwin'* ]]; then
echo "macos runner detected"
sudo installer -pkg ballerina-${{ inputs.version }}-swan-lake-macos-x64.pkg -target /Library
echo "BALLERINA_HOME=/Library/Ballerina" >> $GITHUB_ENV
echo "/Library/Ballerina/bin" >> $GITHUB_PATH
else
echo "ubuntu runner detected"
if [ "$(id --user)" -eq "0" ]; then
sudocmd=""
else
sudocmd="sudo"
fi
$sudocmd dpkg -i "ballerina-${{ inputs.version }}-swan-lake-linux-x64.deb"
echo "BALLERINA_HOME=/usr/lib/ballerina" >> $GITHUB_ENV
echo "/usr/lib/ballerina/bin" >> $GITHUB_PATH
fi
shell: bash