Skip to content

Commit

Permalink
Add workflow info and links
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrl authored Apr 24, 2023
1 parent 7bd553f commit e64ffa5
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ This example pushes the `2.5` version of the image.

{% data reusables.package_registry.publishing-user-scoped-packages %} You can link a published package to a repository using the user interface or command line. For more information, see "[AUTOTITLE](/packages/learn-github-packages/connecting-a-repository-to-a-package)."

Also if you push a container image without the proper labels, GitHub will not connect the package to the repository. This results in the "[GITHUB_TOKEN](/actions/security-guides/automatic-token-authentication)" not having the appropriate permissions for this package.
When you push a container image from the command line, the image is not linked to a repository by default. This is the case even if you tag the image with a namespace that matches the name of the repository, such as `{% ifversion fpt or ghec %}ghcr.io{% elsif ghes > 3.4 %}{% data reusables.package_registry.container-registry-example-hostname %}{% endif %}/octocat/my-repo:latest`.

See "[Connecting a repository to a package](/packages/learn-github-packages/connecting-a-repository-to-a-package)".
The easiest way to connect a repository to a container package is to publish the package from a workflow using `${% raw %}{{secrets.GITHUB_TOKEN}}{% endraw %}`, as the repository that contains the workflow is linked automatically. Note that the `GITHUB_TOKEN` will not have permission to push the package if you have previously pushed a package to the same namespace, but have not connected the package to the repository.

To connect a repository when publishing an image from the command line, and to ensure your `GITHUB_TOKEN` has appropriate permissions when using a GitHub Actions workflow, we recommend adding the label `org.opencontainers.image.source` to your `Dockerfile`. For more information, see “[Labelling container images](#labelling-container-images)” in this article and “[AUTOTITLE](/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions).”

## Pulling container images

Expand Down

0 comments on commit e64ffa5

Please sign in to comment.