From bec311d383534525e292f15d96c8d309d615e37c Mon Sep 17 00:00:00 2001 From: Dan Bamikiya Date: Tue, 18 May 2021 10:31:46 +0100 Subject: [PATCH] Update migrating-to-github-container-registry-for-docker-images.md (#5886) * Update migrating-to-github-container-registry-for-docker-images.md This commit solves #5020. By preferring the use of the GITHUB_TOKEN instead of CR_PAT. * Fix reusable * Update container registry docs This commit makes the migrating-to-github-container-registry-for-docker-images.md more descriptive about using the Github Token for workflow authentication. Co-authored-by: hubwriter Co-authored-by: Jessica Canepa Co-authored-by: hubwriter --- ...-to-the-container-registry-from-the-docker-registry.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry.md b/content/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry.md index 1364893e45..3de09510d9 100644 --- a/content/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry.md +++ b/content/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry.md @@ -95,9 +95,9 @@ If you have a {% data variables.product.prodname_actions %} workflow that uses a 2. In your {% data variables.product.prodname_actions %} workflow file, update the package url from `https://docker.pkg.github.com` to `ghcr.io`. -3. Add your new {% data variables.product.prodname_container_registry %} authentication personal access token (PAT) as a GitHub Actions secret. The {% data variables.product.prodname_container_registry %} does not support using `GITHUB_TOKEN` for your PAT so you must use a different custom variable, such as `CR_PAT`. For more information, see "[Creating and storing encrypted secrets](/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)." +3. Use the `GITHUB_TOKEN` for your authentication personal access token (PAT). For more information, see "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow)." -4. In your {% data variables.product.prodname_actions %} workflow file, update the authentication PAT by replacing your Docker registry PAT ({% raw %}`${{ secrets.GITHUB_TOKEN }}`{% endraw %}) with a new variable for your {% data variables.product.prodname_container_registry %} PAT, such as {% raw %}`${{ secrets.CR_PAT }}`{% endraw %}. +4. In your {% data variables.product.prodname_actions %} workflow file, use the authentication token {% raw %}`${{ secrets.GITHUB_TOKEN }}`{% endraw %} as your {% data variables.product.prodname_container_registry %} PAT. #### Example of updated workflow @@ -112,12 +112,12 @@ docker push docker.pkg.github.com/github/octoshift/octoshift:$GITHUB_SHA ``` {% endraw %} -Then you'll need to update your workflow with the new {% data variables.product.prodname_container_registry %} URL and PAT like this: +Then you'll need to update your workflow with the new {% data variables.product.prodname_container_registry %} URL like this: {% raw %} ```yaml # new login with new container registry url and PAT -echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin +echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin # new container registry urls added docker pull ghcr.io/github/octoshift:latest docker build . --tag ghcr.io/github/octoshift:$GITHUB_SHA --cache-from ghcr.io/github/octoshift:latest