Skip to content

imjasonh/setup-crane

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Action to install and setup crane

Build

Example usage

name: Publish

on:
  push:
    branches: ['main']

jobs:
  publish:
    name: Publish
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: 1.15
      - uses: actions/checkout@v2

      - uses: imjasonh/[email protected]
      - run: |
        crane digest ubuntu
        crane manifest ubuntu | jq
        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.

The action works on Linux and macOS runners.

Select crane version to install

By default, imjasonh/setup-crane installs the latest released version of crane.

You can select a version with the version parameter:

- uses: imjasonh/[email protected]
  with:
    version: v0.5.1

To build and install crane from source using go get, specify version: tip.

Pushing to other registries

By default, imjasonh/setup-crane configures crane to authorize requests to GitHub Container Registry, but you can configure it to useuse other registries as well.

To do this, you need to provide credentials to authorize the push. You can use encrypted secrets to store the authorization token, and pass it to crane auth login before pushing:

- uses: imjasonh/[email protected]
- env:
    auth_token: ${{ secrets.auth_token }}
  run: |
    echo "${auth_token}" | crane auth login https://my.registry --username my-username --password-stdin
    crane digest my.registry/my/image

A note on versioning

The @v0.1 in the uses statement refers to the version of the action definition in this repo.

Regardless of what version of the action definition you use, imjasonh/setup-crane will install the latest released version of crane unless otherwise specified with version:.