Skip to content

Commit

Permalink
Push images to GitHub Container Registry in addition to DockerHub (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanTAllen authored Aug 30, 2023
1 parent 29f1c1c commit c48bc91
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 22 deletions.
57 changes: 48 additions & 9 deletions .github/workflows/update-latest-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,26 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Login to Docker Hub
- name: Login to DockerHub
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
- name: Build
run: make build-latest config=public
- name: Push
run: make push-latest config=public
- name: Build and push to DockerHub
run: |
make build-latest config=dockerhub
make push-latest config=dockerhub
- name: Login to GitHub Container Registry
# v2.2.0
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push to GitHub Container Registry
run: |
make build-latest config=public
make push-latest config=public
- name: Send alert on failure
if: ${{ failure() }}
uses: zulip/github-actions-zulip/send-message@b62d5a0e48a4d984ea4fce5dd65ba691963d4db4
Expand All @@ -45,7 +56,8 @@ jobs:
- name: Checkout source
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
# v2.2.0
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -68,11 +80,11 @@ jobs:
topic: ${{ github.repository }} scheduled job failure
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.

prune-untagged-images:
prune-untagged-public-images:
needs:
- rebuild-private-latest-image
- rebuild-public-latest-image

name: Prune untagged images
name: Prune untagged public images
runs-on: ubuntu-latest
steps:
- name: Prune
Expand All @@ -94,3 +106,30 @@ jobs:
type: stream
topic: ${{ github.repository }} scheduled job failure
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.

prune-untagged-private-images:
needs:
- rebuild-private-latest-image

name: Prune untagged private images
runs-on: ubuntu-latest
steps:
- name: Prune
# v4.1.1
uses: actions/delete-package-versions@0d39a63126868f5eefaa47169615edd3c0f61e20
with:
package-name: 'library-documentation-action-v2-insiders'
package-type: 'container'
min-versions-to-keep: 1
delete-only-untagged-versions: 'true'
- name: Send alert on failure
if: ${{ failure() }}
uses: zulip/github-actions-zulip/send-message@b62d5a0e48a4d984ea4fce5dd65ba691963d4db4
with:
api-key: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_API_KEY }}
email: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_EMAIL }}
organization-url: 'https://ponylang.zulipchat.com/'
to: notifications
type: stream
topic: ${{ github.repository }} scheduled job failure
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.
46 changes: 35 additions & 11 deletions .github/workflows/update-release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,26 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Login to Docker Hub
- name: Login to DockerHub
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
- name: Build
run: make build-release config=public
- name: Push
run: make push-release config=public
- name: Build and Push to DockerHub
run: |
make build-release config=dockerhub
make push-release config=dockerhub
- name: Login to GitHub Container Registry
# v2.2.0
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push to GitHub Container Registry
run: |
make build-release config=public
make push-release config=public
- name: Send alert on failure
if: ${{ failure() }}
uses: zulip/github-actions-zulip/send-message@b62d5a0e48a4d984ea4fce5dd65ba691963d4db4
Expand All @@ -45,7 +56,8 @@ jobs:
- name: Checkout source
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
# v2.2.0
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand Down Expand Up @@ -82,12 +94,23 @@ jobs:
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
- name: Build
run: make build version="${VERSION}" config=public
- name: Build and Push to DockerHub
run: |
make build version="${VERSION}" config=dockerhub
make push version="${VERSION}" config=dockerhub
env:
VERSION: ${{ github.event.client_payload.version }}
- name: Push
run: make push version="${VERSION}" config=public
- name: Login to GitHub Container Registry
# v2.2.0
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push to GitHub Container Registry
run: |
make build version="${VERSION}" config=public
make push version="${VERSION}" config=public
env:
VERSION: ${{ github.event.client_payload.version }}
- name: Send alert on failure
Expand All @@ -112,7 +135,8 @@ jobs:
- name: Checkout source
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
# v2.2.0
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
config ?= public

ifdef config
ifeq (,$(filter $(config),public private))
ifeq (,$(filter $(config),public private dockerhub))
$(error Unknown configuration "$(config)")
endif
endif

ifeq ($(config),private)
IMAGE := ghcr.io/ponylang/library-documentation-action-v2-insiders
PACKAGE = "git+https://${MATERIAL_INSIDERS_ACCESS}@github.com/squidfunk/mkdocs-material-insiders.git"
else
else ifeq ($(config),dockerhub)
IMAGE = ponylang/library-documentation-action-v2
PACKAGE = "mkdocs-material"
else
IMAGE = ghcr.io/ponylang/library-documentation-action-v2
PACKAGE = "mkdocs-material"
endif

all: pylint
Expand Down

0 comments on commit c48bc91

Please sign in to comment.