Skip to content

Commit 31b88ef

Browse files
authored
Merge pull request #12 from imjasonh/windows
update use-action for Windows
2 parents 00c9e93 + 54699f9 commit 31b88ef

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

.github/workflows/use-action.yaml

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
name: Use Action
22

33
on:
4+
pull_request:
5+
branches: ['main']
46
push:
57
branches: ['main']
68

79
jobs:
810
use-action:
911
name: Use Action
1012
strategy:
13+
fail-fast: false
1114
matrix:
12-
platform: [ubuntu-latest, macos-latest]
15+
platform: [ubuntu-latest, macos-latest, windows-latest]
1316
runs-on: ${{ matrix.platform }}
17+
defaults:
18+
run:
19+
shell: bash
1420

1521
steps:
16-
- uses: actions/setup-go@v2
22+
- uses: actions/setup-go@v5
1723
with:
18-
go-version: 1.20.x
19-
- uses: actions/checkout@v2
24+
go-version: 1.21.x
25+
- uses: actions/checkout@v4
2026

21-
- uses: imjasonh/setup-crane@main
27+
- uses: ./
2228
- run: |
2329
crane digest ubuntu
2430
crane manifest ubuntu | jq
2531
crane copy ubuntu ghcr.io/${{ github.repository }}/ubuntu-copy
2632
2733
- name: Install old release
28-
uses: imjasonh/setup-crane@main
34+
uses: ./
2935
with:
3036
version: v0.12.0
3137
- name: Check installed version
3238
run: crane version | grep 0.12.0
3339

3440
- name: Install from tip
35-
uses: imjasonh/setup-crane@main
41+
uses: ./
3642
with:
3743
version: tip
3844
- name: Check installed version (tip)
3945
run: |
40-
sudo rm /usr/local/bin/crane # Uninstall previous versions.
46+
rm $(which crane) # Uninstall previous versions.
4147
crane version

action.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,25 @@ runs:
3535
if [[ $os == "macOS" ]]; then
3636
os="Darwin"
3737
fi
38-
38+
3939
arch=$(uname -m)
4040
if [[ "$arch" =~ (aarch64|arm64) ]] ; then
4141
arch=arm64
42-
fi
42+
fi
43+
44+
out=crane
45+
if [[ "${os}" == "Windows" ]]; then
46+
out=crane.exe
47+
fi
4348
4449
if [[ ! -z ${tag} ]]; then
4550
echo "Installing crane @ ${tag} for ${os} on ${arch}"
46-
curl -fsL https://github.com/google/go-containerregistry/releases/download/${tag}/go-containerregistry_${os}_${arch}.tar.gz | sudo tar xzf - -C /usr/local/bin crane
51+
tmp=$(mktemp -d)
52+
cd ${tmp}
53+
curl -fsL https://github.com/google/go-containerregistry/releases/download/${tag}/go-containerregistry_${os}_${arch}.tar.gz | tar xz ${out}
54+
chmod +x ${tmp}/${out}
55+
PATH=${PATH}:${tmp}
56+
echo "${tmp}" >> $GITHUB_PATH
4757
fi
4858
4959
# NB: username doesn't seem to matter.

0 commit comments

Comments
 (0)