-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
87 lines (81 loc) · 3.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
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: "Pharo setup"
description: "Install Pharo Virtual Machine and image."
inputs:
version:
description: "Pharo version number to install. (e.g. 13)"
required: true
imageName:
description: "Save the Pharo image under this name"
default: "Pharo"
imageDir:
description: "Path where the Pharo image will be downloaded"
default: ${{ github.workspace }}
vmDir:
description: "Path where the Pharo VM will be downloaded"
default: ${{ github.workspace }}/pharo-vm
useBashOnWindows:
description: |
Tells if the $PHARO environment variable should be defined as a Linux path so that it can be used in a Bash shell.
If not set or false, the $PHARO command will use Windows path and is intended to be used with Powershell or Cmd.
default: false
runs:
using: "composite"
steps:
- name: Set env vars related to system
id: vars
run: |
echo "HOST_ARCH=x86_64" >> $GITHUB_ENV
case "${RUNNER_OS}" in
macOS) HOST_OS=Darwin;;
*) HOST_OS=$RUNNER_OS
esac
echo "HOST_OS=$HOST_OS" >> $GITHUB_ENV
echo "FILES_URL=https://files.pharo.org/get-files/${{ inputs.version }}0" >> $GITHUB_ENV
VM_DIR=$(echo "${{ inputs.vmDir }}" | sed 's#\\#/#g')
echo "VM_DIR=$VM_DIR" >> $GITHUB_OUTPUT
IMAGE_DIR=$(echo "${{ inputs.imageDir }}" | sed 's#\\#/#g')
echo "IMAGE_DIR=$IMAGE_DIR" >> $GITHUB_OUTPUT
shell: bash
- name: Install Pharo VM
run: |
VM_STATUS="stable"
URL="${{ env.FILES_URL }}/pharo-vm-${{ env.HOST_OS }}-${{ env.HOST_ARCH }}-${VM_STATUS}.zip"
mkdir -p $(dirname ${{ steps.vars.outputs.VM_DIR }})
echo "Downloading $URL to ${{ steps.vars.outputs.VM_DIR }}"
curl -L $URL -o pharo-vm.zip
unzip -q pharo-vm.zip -d ${{ steps.vars.outputs.VM_DIR }}
rm -f pharo-vm.zip
shell: bash
- name: Get Pharo image
run: |
IMAGE_PATH=pharoImage-x86_64.zip
URL="${FILES_URL}/pharoImage-${HOST_ARCH}.zip"
echo "Downloading $URL"
curl -L ${URL} -o pharo-image.zip
unzip pharo-image.zip -d image
rm -f pharo-image.zip
mkdir -p ${{ steps.vars.outputs.IMAGE_DIR }}
find image -name '*.image' -exec mv '{}' ${{ steps.vars.outputs.IMAGE_DIR }}/${{ inputs.imageName }}.image \;
find image -name '*.changes' -exec mv '{}' ${{ steps.vars.outputs.IMAGE_DIR }}/${{ inputs.imageName }}.changes \;
mv image/*.sources ${{ steps.vars.outputs.IMAGE_DIR }}
rm -rf image
shell: bash
- name: Append Pharo to the PATH
run: |
echo "${{ inputs.vmDir }}" >> $GITHUB_PATH
case "${RUNNER_OS}" in
Linux) PHARO=${{ inputs.vmDir }}/pharo;;
Windows) VM_DIR_WIN=$(echo "${{ inputs.vmDir }}" | sed 's#/#\\#g')
PHARO=$VM_DIR_WIN\\PharoConsole.exe
PHARO_BASH=${{ steps.vars.outputs.VM_DIR }}/PharoConsole.exe
if [[ ${{ inputs.useBashOnWindows }} == 'true' ]]; then
PHARO=$PHARO_BASH
echo "PHARO_WIN=$PHARO" >> $GITHUB_ENV
else
echo "PHARO_BASH=$PHARO_BASH" >> $GITHUB_ENV
fi;;
macOS) PHARO=${{ inputs.vmDir }}/Pharo.app/Contents/MacOS/Pharo;;
esac
echo "Setting \$PHARO alias to $PHARO"
echo "PHARO=$PHARO" >> $GITHUB_ENV
shell: bash