-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
94 lines (87 loc) · 3.95 KB
/
action.yml
File metadata and controls
94 lines (87 loc) · 3.95 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
name: "Setup lde"
description: "Install lde package manager"
branding:
color: blue
icon: moon
inputs:
version:
description: "Version to install (e.g., '0.8.1', 'latest', or 'nightly')"
required: false
default: "latest"
platform:
description: "Override platform (e.g., 'Linux', 'Darwin', 'Android'). Defaults to auto-detected."
required: false
default: ""
arch:
description: "Override architecture (e.g., 'x86_64', 'aarch64'). Defaults to auto-detected."
required: false
default: ""
runs:
using: "composite"
steps:
- name: Resolve version
id: resolve
shell: bash
run: |
VERSION="${{ inputs.version }}"
if [ "$VERSION" = "nightly" ]; then
echo "tag=nightly" >> "$GITHUB_OUTPUT"
elif [ "$VERSION" = "latest" ]; then
TAG=$(curl -sfL "https://github.com/lde-org/lde/releases/latest" -o /dev/null -w '%{url_effective}' | sed 's|.*/||')
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
else
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
fi
- name: Determine asset name (Unix)
if: runner.os != 'Windows'
id: asset_unix
shell: bash
run: |
OS="${{ inputs.platform }}"
ARCH="${{ inputs.arch }}"
[ -z "$OS" ] && { [ "$(uname -o)" = "Android" ] && OS="Android" || OS="$(uname -s)"; }
[ -z "$ARCH" ] && ARCH="$(uname -m)"
case "$OS-$ARCH" in
Linux-x86_64) echo "asset=lde-linux-x86-64" >> "$GITHUB_OUTPUT" ;;
Linux-aarch64) echo "asset=lde-linux-aarch64" >> "$GITHUB_OUTPUT" ;;
Android-aarch64) echo "asset=lde-android-aarch64" >> "$GITHUB_OUTPUT" ;;
Darwin-x86_64) echo "asset=lde-macos-x86-64" >> "$GITHUB_OUTPUT" ;;
Darwin-arm64) echo "asset=lde-macos-aarch64" >> "$GITHUB_OUTPUT" ;;
*) echo "Unsupported platform: $OS $ARCH"; exit 1 ;;
esac
- name: Determine asset name (Windows)
if: runner.os == 'Windows'
id: asset_windows
shell: pwsh
run: |
$arch = if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") { "aarch64" } else { "x86-64" }
echo "asset=lde-windows-$arch.exe" >> $env:GITHUB_OUTPUT
- name: Cache lde
id: cache
uses: actions/cache@v5
with:
path: ~/.lde/lde${{ runner.os == 'Windows' && '.exe' || '' }}
key: lde-${{ steps.resolve.outputs.tag }}-${{ runner.os }}-${{ runner.arch }}${{ inputs.platform != '' && format('-{0}', inputs.platform) || '' }}
- name: Install lde (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
mkdir -p "$HOME/.lde"
if [ "${{ steps.cache.outputs.cache-hit }}" != "true" ]; then
curl -fL "https://github.com/lde-org/lde/releases/download/${{ steps.resolve.outputs.tag }}/${{ steps.asset_unix.outputs.asset }}" \
-o "$HOME/.lde/lde"
chmod +x "$HOME/.lde/lde"
fi
[ -z "${{ inputs.platform }}" ] && "$HOME/.lde/lde" --setup
echo "$HOME/.lde" >> "$GITHUB_PATH"
- name: Install lde (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory "$env:USERPROFILE\.lde" -Force | Out-Null
if ("${{ steps.cache.outputs.cache-hit }}" -ne "true") {
Invoke-WebRequest "https://github.com/lde-org/lde/releases/download/${{ steps.resolve.outputs.tag }}/${{ steps.asset_windows.outputs.asset }}" `
-OutFile "$env:USERPROFILE\.lde\lde.exe"
}
& "$env:USERPROFILE\.lde\lde.exe" --setup
echo "$env:USERPROFILE\.lde" >> $env:GITHUB_PATH