Skip to content

Commit

Permalink
pathogen-repo-ci: Log in to docker.io and ghcr.io if possible
Browse files Browse the repository at this point in the history
For docker.io, this lifts low rate limits on image pulls.  For ghcr.io,
this allows the use of docker-base images we transiently stage there
before publishing to docker.io.

A new "permissions:" block with "packages: read" restricts the ghcr.io
access to read-only.  This addition requires explicitly enumerating the
rest of the required permissions too, which is only "contents: read".

Related-to: <nextstrain/docker-base#148>
  • Loading branch information
tsibley committed May 5, 2023
1 parent 2eb4a54 commit 85745d4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/pathogen-repo-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,39 @@ on:
default: ""
required: false

permissions:
contents: read
packages: read

jobs:
build:
runs-on: ubuntu-latest
steps:
# Log in, if possible, to docker.io (Docker Hub), since authenticated
# requests get higher rate limits (e.g. for image pulls). Our org-level
# secret DOCKER_TOKEN_PUBLIC_READ_ONLY is available to all our public
# repos on GitHub but only available here to this reusable workflow when
# called with "secrets: inherit". On Docker Hub, the token is granted
# "public read-only" access.
- name: Log in to docker.io
uses: docker/login-action@v2
with:
registry: docker.io
username: nextstrainbot
password: ${{ secrets.DOCKER_TOKEN_PUBLIC_READ_ONLY }}
continue-on-error: true

# Log in, if possible, to ghcr.io which we use for staging images in
# nextstrain/docker-base. The automatic GITHUB_TOKEN is restricted to
# read-only access by the "permissions:" block above.
- name: Log in to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true

# Transforms the inputs.env *string* containing YAML like this:
#
# FOO: bar
Expand Down

0 comments on commit 85745d4

Please sign in to comment.