Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add GitHub container registry for stable images #521

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,20 @@ jobs:
password: ${{ secrets.PYPI_API_TOKEN }}
print-hash: true

## DOCKER
## DOCKER (DOCKER HUB & CONTAINER REGISTRY)

# figure out which docker tags we need to push
docker-determine-tags:
runs-on: "ubuntu-latest"
needs:
- "tests"
env:
STABLE_IMAGES: '["pypiserver/pypiserver", "ghcr.io/pypiserver/pypiserver"]'
FLEXIBLE_IMAGES: '["pypiserver/pypiserver"]'
outputs:
tags: "${{ steps.tags.outputs.tags }}"
has_tags: "${{ steps.has_tags.outputs.has_tags }}"
images: ${{ contains(steps.tags.outputs.tags, 'unstable') && env.FLEXIBLE_IMAGES || env.STABLE_IMAGES }}
steps:
- uses: "actions/checkout@v3"

Expand All @@ -166,10 +173,6 @@ jobs:
run: >-
echo "::set-output name=has_tags::$(bin/ci_helper.py ${{ github.ref }} has_tags)"

outputs:
tags: "${{ steps.tags.outputs.tags }}"
has_tags: "${{ steps.has_tags.outputs.has_tags }}"

# Deploy any needed docker tags
deploy-docker:
runs-on: "ubuntu-latest"
Expand All @@ -179,6 +182,7 @@ jobs:
strategy:
matrix:
tag: "${{ fromJson(needs.docker-determine-tags.outputs.tags) }}"
image: "${{ fromJson(needs.docker-determine-tags.outputs.images) }}"
steps:
- uses: "actions/checkout@v3"

Expand All @@ -196,6 +200,13 @@ jobs:
username: "${{ secrets.DOCKER_HUB_USER }}"
password: "${{ secrets.DOCKER_HUB_TOKEN }}"

- name: "Login to GitHub Container Registry"
uses: "docker/login-action@v2"
with:
registry: "ghcr.io"
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Set up Docker Buildx"
id: "buildx"
uses: "docker/setup-buildx-action@v1"
Expand All @@ -208,7 +219,7 @@ jobs:
file: "./Dockerfile"
builder: "${{ steps.buildx.outputs.name }}"
push: true
tags: "pypiserver/pypiserver:${{ matrix.tag }}"
tags: "${{ matrix.image }}:${{ matrix.tag }}"
cache-from: "type=local,src=/tmp/.buildx-cache"
cache-to: "type=local,dest=/tmp/.buildx-cache"

Expand Down
12 changes: 11 additions & 1 deletion docs/contents/repo-maintenance/release-work.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ flowchart LR
pk["build-and-pack 📦"]
py["pypi-index 🗃️"]
do["docker-hub 🐳"]
gh["gh-container-registry 🚀"]
gr["github-release 📣"]

subgraph "Preparation 🌱"
Expand All @@ -23,7 +24,7 @@ flowchart LR
rm-->ci-->pk
end
subgraph "Deploy 🌳"
pk--> py & do & gr
pk--> py & do & gh & gr
end
```

Expand Down Expand Up @@ -101,6 +102,15 @@ If all is successful so far, [`ci.yml`](../../../.github/workflows/ci.yml) tags
the built docker images and pushes them to the
[`pypiserver` Docker Hub repository](https://hub.docker.com/r/pypiserver/pypiserver).

#### Publish to GitHub Container Registry 🚀

> 🏷️ Docker image *tags* are determined on the fly.

For all `stable` (i.e. `latest`, tag, release ...) tags derived by
[`ci.yml`](../../../.github/workflows/ci.yml) tags,
the built docker images are *also* pushed to
[`pypiserver` GitHub Container Registry](https://github.com/orgs/pypiserver/packages?repo_name=pypiserver).

#### Publish a GitHub Release draft 📣

> 🛠️ *This step is applicable only for maintainers.*
Expand Down
Loading