-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
85 lines (76 loc) · 2.97 KB
/
Copy pathaction.yml
File metadata and controls
85 lines (76 loc) · 2.97 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
name: 'Setup Effigy'
description: 'Download and cache the Effigy task runner binary'
author: 'inflatable-cookie'
branding:
icon: 'terminal'
color: 'orange'
inputs:
version:
description: 'Effigy version to install (e.g. 0.2.7)'
required: true
token:
description: 'GitHub token for downloading release assets'
required: false
default: ${{ github.token }}
outputs:
version:
description: 'The installed Effigy version'
value: ${{ inputs.version }}
cache-hit:
description: 'Whether the binary was restored from cache'
value: ${{ steps.cache.outputs.cache-hit }}
runs:
using: 'composite'
steps:
- name: Detect platform
id: platform
shell: bash
run: |
TOOL_CACHE="${RUNNER_TOOL_CACHE:-${HOME}/.effigy-cache}"
case "${{ runner.os }}-${{ runner.arch }}" in
Linux-X64) triple="x86_64-unknown-linux-gnu" ;;
Linux-ARM64) triple="aarch64-unknown-linux-gnu" ;;
macOS-ARM64) triple="aarch64-apple-darwin" ;;
macOS-X64) triple="x86_64-apple-darwin" ;;
*)
echo "::error::Unsupported platform: ${{ runner.os }}-${{ runner.arch }}"
exit 1
;;
esac
echo "triple=${triple}" >> "$GITHUB_OUTPUT"
echo "install-dir=${TOOL_CACHE}/effigy/${{ inputs.version }}/${triple}" >> "$GITHUB_OUTPUT"
- name: Create install directory
shell: bash
run: mkdir -p "${{ steps.platform.outputs.install-dir }}"
- name: Cache Effigy binary
id: cache
uses: actions/cache@v4
with:
path: ${{ steps.platform.outputs.install-dir }}
key: effigy-${{ inputs.version }}-${{ steps.platform.outputs.triple }}
- name: Download Effigy binary
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
run: |
url="https://github.com/inflatable-cookie/effigy/releases/download/v${{ inputs.version }}/effigy-${{ steps.platform.outputs.triple }}"
echo "Downloading effigy v${{ inputs.version }} for ${{ steps.platform.outputs.triple }}"
curl -fsSL \
-H "Authorization: token ${GH_TOKEN}" \
-o "${{ steps.platform.outputs.install-dir }}/effigy" \
"${url}" || {
echo "::error::Failed to download effigy v${{ inputs.version }} for ${{ steps.platform.outputs.triple }}"
echo "::error::Check that the version exists at https://github.com/inflatable-cookie/effigy/releases/tag/v${{ inputs.version }}"
exit 1
}
chmod +x "${{ steps.platform.outputs.install-dir }}/effigy"
- name: Add to PATH
shell: bash
run: echo "${{ steps.platform.outputs.install-dir }}" >> "$GITHUB_PATH"
- name: Verify installation
shell: bash
run: |
chmod +x "${{ steps.platform.outputs.install-dir }}/effigy"
"${{ steps.platform.outputs.install-dir }}/effigy" --help > /dev/null
echo "Effigy v${{ inputs.version }} installed successfully"