From 9c109c7824e65774bd21cd406fbd52c227f3c40d Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 1 Sep 2020 20:38:53 +0200 Subject: [PATCH 1/2] Add example for GitHub Container Registry --- README.md | 58 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 88be1ac..43f358a 100644 --- a/README.md +++ b/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 From 99533eb7f40035b887eb5d9417420041ad81209a Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 1 Sep 2020 20:48:41 +0200 Subject: [PATCH 2/2] Remove pre-checkin workflow (not needed) --- .github/workflows/pre-checkin.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .github/workflows/pre-checkin.yml diff --git a/.github/workflows/pre-checkin.yml b/.github/workflows/pre-checkin.yml deleted file mode 100644 index 02dfb1c..0000000 --- a/.github/workflows/pre-checkin.yml +++ /dev/null @@ -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