Merge pull request #5 from crazy-max/ghcr-example
Add example for GitHub Container Registry
This commit is contained in:
commit
afed83d63e
|
@ -1,30 +0,0 @@
|
|||
name: pre-checkin
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
pre-checkin:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2.3.2
|
||||
-
|
||||
name: Install
|
||||
run: yarn install
|
||||
-
|
||||
name: Pre-checkin
|
||||
run: yarn run pre-checkin
|
||||
-
|
||||
name: Check for uncommitted changes
|
||||
run: |
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
git status --porcelain
|
||||
echo "::warning::Found changes. Please run 'yarn run pre-checkin' and push"
|
||||
fi
|
58
README.md
58
README.md
|
@ -8,13 +8,19 @@
|
|||
|
||||
GitHub Action to login against a Docker registry.
|
||||
|
||||
> :bulb: See also:
|
||||
> * [setup-buildx](https://github.com/docker/setup-buildx-action) action
|
||||
> * [setup-qemu](https://github.com/docker/setup-qemu-action) action
|
||||
> * [build-push](https://github.com/docker/build-push-action) action
|
||||
|
||||
![Screenshot](.github/docker-login.png)
|
||||
|
||||
___
|
||||
|
||||
* [Usage](#usage)
|
||||
* [DockerHub](#dockerhub)
|
||||
* [GitHub Package Registry](#github-package-registry)
|
||||
* [GitHub Packages Docker Registry](#github-packages-docker-registry)
|
||||
* [GitHub Container Registry](#github-container-registry)
|
||||
* [GitLab](#gitlab)
|
||||
* [Azure Container Registry (ACR)](#azure-container-registry-acr)
|
||||
* [Google Container Registry (GCR)](#google-container-registry-gcr)
|
||||
|
@ -39,9 +45,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
|
@ -50,7 +53,9 @@ jobs:
|
|||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
```
|
||||
|
||||
### GitHub Package Registry
|
||||
### GitHub Packages Docker Registry
|
||||
|
||||
You can configure the Docker client to use [GitHub Packages to publish and retrieve docker images](https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages).
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
|
@ -64,10 +69,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to GitHub Package Registry
|
||||
name: Login to GitHub Packages Docker Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: docker.pkg.github.com
|
||||
|
@ -75,6 +77,32 @@ jobs:
|
|||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
### GitHub Container Registry
|
||||
|
||||
To authenticate against the [GitHub Container Registry](https://docs.github.com/en/packages/getting-started-with-github-container-registry),
|
||||
you will need to create a new [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
|
||||
with the [appropriate scopes](https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry).
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
```
|
||||
|
||||
### GitLab
|
||||
|
||||
```yaml
|
||||
|
@ -88,9 +116,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to GitLab
|
||||
uses: docker/login-action@v1
|
||||
|
@ -117,9 +142,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to ACR
|
||||
uses: docker/login-action@v1
|
||||
|
@ -149,9 +171,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to GCR
|
||||
uses: docker/login-action@v1
|
||||
|
@ -178,9 +197,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to ECR
|
||||
uses: docker/login-action@v1
|
||||
|
|
Loading…
Reference in New Issue