-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
72 lines (67 loc) · 1.88 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
name: 'Setup goose'
description: 'Install and authorize goose'
branding:
icon: box
color: green
inputs:
version:
description: 'Version of goose to install (tip, latest-release, v0.14.1, etc.)'
required: true
default: 'latest-release'
runs:
using: "composite"
steps:
- shell: bash
run: |
set -ex
# Install goose:
# - if version is "tip", install from tip of main.
# - if version is "latest-release", look up latest release.
# - otherwise, install the specified version.
case ${{ inputs.version }} in
tip)
echo "Installing goose using go install"
go install github.com/pressly/goose/v3/cmd/goose@latest
;;
latest-release)
tag=$(curl -L -s -u "username:${{ github.token }}" https://api.github.com/repos/pressly/goose/releases/latest | jq -r '.tag_name')
;;
*)
tag="${{ inputs.version }}"
esac
case ${{ runner.os }} in
macOS)
os="darwin"
;;
Windows)
os="windows"
;;
"Linux")
os="linux"
;;
*)
echo "Unsupported OS: ${{ runner.os }}"
exit 1
;;
esac
case ${{ runner.arch }} in
"X64")
arch="x86_64"
;;
"ARM64")
arch="arm64"
;;
*)
echo "Unsupported architecture: ${{ runner.arch }}"
exit 1
;;
esac
if [[ ! -z ${tag} ]]; then
echo "Installing goose @ ${tag} for ${os}_${arch}"
if [[ $os == "windows" ]]; then
powershell -Command "Invoke-WebRequest -Uri https://github.com/pressly/goose/releases/download/${tag}/goose_${os}_${arch}.exe -OutFile C:\goose\goose.exe"
else
curl -fsL https://github.com/pressly/goose/releases/download/${tag}/goose_${os}_${arch} > /usr/local/bin/goose
chmod +x /usr/local/bin/goose
fi
fi