Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/use-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
push:
branches: ['main']

permissions: {}

jobs:
use-action:
name: Use Action
Expand All @@ -17,6 +19,9 @@ jobs:
defaults:
run:
shell: bash

permissions:
packages: write

steps:
- uses: actions/setup-go@v5
Expand All @@ -28,6 +33,8 @@ jobs:
- run: |
crane digest ubuntu
crane manifest ubuntu | jq
- if: github.event_name == 'push'
run: |
crane copy ubuntu ghcr.io/${{ github.repository }}/ubuntu-copy

- name: Install old release
Expand Down
12 changes: 8 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ runs:
using: "composite"
steps:
- shell: bash
env:
VERSION: ${{ inputs.version }}
RUNNER_OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ github.token }}
run: |
set -ex

# Install crane:
# - if version is "tip", install from tip of main.
# - if version is "latest-release", use the latest release URL.
# - otherwise, install the specified version.
case ${{ inputs.version }} in
case "${VERSION}" in
tip)
echo "Installing crane using go get"
go install github.com/google/go-containerregistry/cmd/crane@main
Expand All @@ -28,10 +32,10 @@ runs:
url="https://github.com/google/go-containerregistry/releases/latest/download"
;;
*)
url="https://github.com/google/go-containerregistry/releases/download/${{ inputs.version }}"
url="https://github.com/google/go-containerregistry/releases/download/${VERSION}"
esac

os=${{ runner.os }}
os="${RUNNER_OS}"
if [[ $os == "macOS" ]]; then
os="Darwin"
fi
Expand Down Expand Up @@ -59,4 +63,4 @@ runs:
fi

# NB: username doesn't seem to matter.
echo "${{ github.token }}" | crane auth login ghcr.io --username "dummy" --password-stdin
echo "${GITHUB_TOKEN}" | crane auth login ghcr.io --username "dummy" --password-stdin
Loading