Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imjasonh/setup-crane
https://github.com/imjasonh/setup-crane
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/imjasonh/setup-crane
- Owner: imjasonh
- License: apache-2.0
- Created: 2021-07-23T15:08:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-11T17:06:19.000Z (7 months ago)
- Last Synced: 2024-11-15T09:52:12.092Z (about 2 months ago)
- Size: 16.6 KB
- Stars: 21
- Watchers: 3
- Forks: 10
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Action to install and setup [`crane`](https://github.com/google/go-containerregistry/cmd/crane/README.md)
[![Build](https://github.com/imjasonh/setup-crane/actions/workflows/use-action.yaml/badge.svg)](https://github.com/imjasonh/setup-crane/actions/workflows/use-action.yaml)
## Example usage
```yaml
name: Publishon:
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](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-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:
```yaml
- 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](https://ghcr.io), 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](https://docs.github.com/en/actions/reference/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:`.