-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
108 lines (107 loc) · 3.69 KB
/
action.yml
File metadata and controls
108 lines (107 loc) · 3.69 KB
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
name: "Setup Jule environment"
description: "Use Jule on GitHub Actions"
author: "julelang"
branding:
icon: code
color: gray-dark
inputs:
version:
description: "The version of Jule that will be downloaded. Use \"latest\" for the latest stable release."
required: true
default: "latest"
directory:
description: "Directory where Jule will be downloaded."
required: true
default: "."
add-to-path:
description: "Whether to add Jule binaries to the PATH or not."
required: false
default: "true"
runs:
using: "composite"
steps:
- name: Adjust Directory (UNIX-Like)
if: runner.os == 'Linux' || runner.os == 'macOS'
shell: bash
run: |
directory="${{ inputs.directory }}"
if [[ ${{ inputs.directory }} == */ ]]; then
directory="${directory%?}"
fi
echo "DIRECTORY=$directory" >> $GITHUB_ENV
- name: Adjust Directory (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$directory = "${{ inputs.directory }}"
if ($directory.EndsWith("/")) {
$directory = $directory.Substring(0, $directory.Length - 1)
}
$directory = $directory -replace '\\', '/'
echo "DIRECTORY=$directory" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install Jule
shell: bash
run: |
os="-"
if [[ "$RUNNER_OS" == "Windows" ]]; then
os="windows"
elif [[ "$RUNNER_OS" == "macOS" ]]; then
os="darwin"
elif [[ "$RUNNER_OS" == "Linux" ]]; then
os="linux"
else
echo "unsupported operating system: ${RUNNER_OS}"
exit 1
fi
arch="-"
if [[ "$RUNNER_ARCH" == "X86" ]]; then
arch="i386"
elif [[ "$RUNNER_ARCH" == "X64" ]]; then
arch="amd64"
elif [[ "$RUNNER_ARCH" == "ARM64" ]]; then
arch="arm64"
else
echo "unsupported architecture: ${RUNNER_ARCH}"
exit 1
fi
target="${os}-${arch}"
if [[ "$target" == "darwin-arm64" ]] || [[ "$target" == "darwin-amd64" ]]; then
:
elif [[ "$target" == "linux-arm64" ]] || [[ "$target" == "linux-amd64" ]] || [[ "$target" == "linux-i386" ]]; then
:
elif [[ "$target" == "windows-arm64" ]] || [[ "$target" == "windows-amd64" ]] || [[ "$target" == "windows-i386" ]]; then
:
else
echo "unsupported target: ${target}"
fi
if [[ ${{ inputs.version }} == "dev" ]]; then
bash <(curl -s https://raw.githubusercontent.com/julelang/julec-ir/main/compile-ir.sh)
if [[ "$DIRECTORY" != "." ]] && [[ "$DIRECTORY" != "./" ]]; then
mv "jule" "$DIRECTORY/jule"
fi
else
version=${{ inputs.version }}
if [[ ${{ inputs.version }} == "latest" ]] || [[ ${{ inputs.version }} == "current" ]]; then
version="jule0.2.0"
fi
curl -L -o release.zip "https://github.com/julelang/jule/releases/download/$version/$version-$target.zip"
unzip release.zip -d "$DIRECTORY"
fi
- name: Add Jule binaries to the PATH (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
if ('${{ inputs.add-to-path }}' -eq 'true') {
echo "$env:DIRECTORY\jule\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
- name: Add Jule binaries to the PATH (UNIX-Like)
if: runner.os == 'Linux' || runner.os == 'macOS'
shell: bash
run: |
if [[ ${{ inputs.add-to-path }} == 'true' ]]; then
echo "$DIRECTORY/jule/bin" >> "$GITHUB_PATH"
fi
- name: Version
shell: bash
run: |
julec version