Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 54699f91ad | |||
| 00c9e93efa | |||
| 779a7240f2 | |||
| 8a78c724ed | |||
| 77ab8b6716 | |||
| 67a61a0d45 | |||
| e82f1b9a80 | |||
| ee5bee9817 | |||
| 01d2668281 | |||
| 0201011286 | |||
| 743562b092 |
@@ -1,6 +1,8 @@
|
||||
name: Use Action
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ['main']
|
||||
push:
|
||||
branches: ['main']
|
||||
|
||||
@@ -8,31 +10,38 @@ jobs:
|
||||
use-action:
|
||||
name: Use Action
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, macos-latest]
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-go@v2
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.16
|
||||
- uses: actions/checkout@v2
|
||||
go-version: 1.21.x
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: imjasonh/setup-crane@main
|
||||
- run: crane digest ubuntu
|
||||
- uses: ./
|
||||
- run: |
|
||||
crane digest ubuntu
|
||||
crane manifest ubuntu | jq
|
||||
crane copy ubuntu ghcr.io/${{ github.repository }}/ubuntu-copy
|
||||
|
||||
- name: Install old release
|
||||
uses: imjasonh/setup-crane@main
|
||||
uses: ./
|
||||
with:
|
||||
version: v0.4.0
|
||||
version: v0.12.0
|
||||
- name: Check installed version
|
||||
run: crane version | grep 0.4.0
|
||||
run: crane version | grep 0.12.0
|
||||
|
||||
- name: Install from tip
|
||||
uses: imjasonh/setup-crane@main
|
||||
uses: ./
|
||||
with:
|
||||
version: tip
|
||||
- name: Check installed version (tip)
|
||||
run: |
|
||||
sudo rm /usr/local/bin/crane # Uninstall previous versions.
|
||||
rm $(which crane) # Uninstall previous versions.
|
||||
crane version
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
- run: |
|
||||
crane digest ubuntu
|
||||
crane manifest ubuntu | jq
|
||||
crane copy ubuntu ghcr.io/${{ github.owner
|
||||
crane copy ubuntu ghcr.io/${{ github.repository }}/ubuntu-copy
|
||||
```
|
||||
|
||||
_That's it!_ This workflow will inspect and copy the `ubuntu` image to your repo's GitHub container registry namespace.
|
||||
|
||||
+18
-3
@@ -22,7 +22,7 @@ runs:
|
||||
case ${{ inputs.version }} in
|
||||
tip)
|
||||
echo "Installing crane using go get"
|
||||
go get github.com/google/go-containerregistry/cmd/crane@main
|
||||
go install github.com/google/go-containerregistry/cmd/crane@main
|
||||
;;
|
||||
latest-release)
|
||||
tag=$(curl -s -u "username:${{ github.token }}" https://api.github.com/repos/google/go-containerregistry/releases/latest | jq -r '.tag_name')
|
||||
@@ -36,9 +36,24 @@ runs:
|
||||
os="Darwin"
|
||||
fi
|
||||
|
||||
arch=$(uname -m)
|
||||
if [[ "$arch" =~ (aarch64|arm64) ]] ; then
|
||||
arch=arm64
|
||||
fi
|
||||
|
||||
out=crane
|
||||
if [[ "${os}" == "Windows" ]]; then
|
||||
out=crane.exe
|
||||
fi
|
||||
|
||||
if [[ ! -z ${tag} ]]; then
|
||||
echo "Installing crane @ ${tag} for ${os}"
|
||||
curl -fsL https://github.com/google/go-containerregistry/releases/download/${tag}/go-containerregistry_${os}_x86_64.tar.gz | sudo tar xzf - -C /usr/local/bin crane
|
||||
echo "Installing crane @ ${tag} for ${os} on ${arch}"
|
||||
tmp=$(mktemp -d)
|
||||
cd ${tmp}
|
||||
curl -fsL https://github.com/google/go-containerregistry/releases/download/${tag}/go-containerregistry_${os}_${arch}.tar.gz | tar xz ${out}
|
||||
chmod +x ${tmp}/${out}
|
||||
PATH=${PATH}:${tmp}
|
||||
echo "${tmp}" >> $GITHUB_PATH
|
||||
fi
|
||||
|
||||
# NB: username doesn't seem to matter.
|
||||
|
||||
Reference in New Issue
Block a user