Skip to content

Commit 31e59e7

Browse files
committed
ci: fix GHCR login to be secrets based
Signed-off-by: Evan Wies <evan@neomantra.net>
1 parent de1da50 commit 31e59e7

2 files changed

Lines changed: 53 additions & 6 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# Builds and publishes the OpenResty Docker image matrix
2+
#
3+
# Copyright (c) 2026 Evan Wies
4+
#
5+
#
6+
# env:
7+
# GHCR_IMAGE: GitHub Container Registry image
8+
# DOCKERHUB_IMAGE: Docker Hub image
9+
#
10+
# secrets:
11+
# GHCR_USERNAME: GitHub Container Registry username
12+
# GHCR_PASSWORD: GitHub Container Registry password
13+
# DOCKERHUB_USERNAME: Docker Hub username
14+
# DOCKERHUB_PASSWORD: Docker Hub password
15+
#
16+
117
name: Docker Build and Publish
218

319
on:
@@ -251,6 +267,13 @@ jobs:
251267
- name: Set up Docker Buildx
252268
uses: docker/setup-buildx-action@v3
253269

270+
- name: Login to GitHub Container Registry
271+
uses: docker/login-action@v3
272+
with:
273+
registry: ghcr.io
274+
username: ${{ secrets.GHCR_USERNAME }}
275+
password: ${{ secrets.GHCR_PASSWORD }}
276+
254277
- name: Login to Docker Mirror
255278
if: vars.ENABLE_DOCKERHUB_MIRROR == 'true'
256279
uses: docker/login-action@v3
@@ -301,8 +324,8 @@ jobs:
301324
uses: docker/login-action@v3
302325
with:
303326
registry: ghcr.io
304-
username: ${{ github.actor }}
305-
password: ${{ secrets.GITHUB_TOKEN }}
327+
username: ${{ secrets.GHCR_USERNAME }}
328+
password: ${{ secrets.GHCR_PASSWORD }}
306329

307330
- name: Login to Docker Hub (Mirror)
308331
if: vars.ENABLE_DOCKERHUB_MIRROR == 'true'
@@ -446,8 +469,8 @@ jobs:
446469
uses: docker/login-action@v3
447470
with:
448471
registry: ghcr.io
449-
username: ${{ github.actor }}
450-
password: ${{ secrets.GITHUB_TOKEN }}
472+
username: ${{ secrets.GHCR_USERNAME }}
473+
password: ${{ secrets.GHCR_PASSWORD }}
451474

452475
- name: Login to Docker Hub (Mirror)
453476
if: vars.ENABLE_DOCKERHUB_MIRROR == 'true'
@@ -512,8 +535,8 @@ jobs:
512535
uses: docker/login-action@v3
513536
with:
514537
registry: ghcr.io
515-
username: ${{ github.actor }}
516-
password: ${{ secrets.GITHUB_TOKEN }}
538+
username: ${{ secrets.GHCR_USERNAME }}
539+
password: ${{ secrets.GHCR_PASSWORD }}
517540

518541
- name: Login to Docker Hub (Mirror)
519542
if: vars.ENABLE_DOCKERHUB_MIRROR == 'true'

BUILDING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,27 @@ docker build --build-arg RESTY_VERSION="1.27.1.2" -f windows/Dockerfile .
220220
|RESTY_VERSION | 1.27.1.2 | The version of OpenResty to use. |
221221

222222
[Back to TOC](#table-of-contents)
223+
224+
GitHub Actions
225+
==============
226+
227+
The GitHub Actions to build is located in the [`.github/workflows/docker-publish.yml`](./.github/workflows/docker-publish.yml) file.
228+
229+
| Environment Variable | Description |
230+
|:---------------------|:----------- |
231+
| GHCR_IMAGE | GitHub Container Registry image |
232+
| DOCKERHUB_IMAGE | Docker Hub image |
233+
234+
| Secrets | Description |
235+
|:---------------------|:----------- |
236+
| GHCR_USERNAME | GitHub Container Registry username |
237+
| GHCR_PASSWORD | GitHub Container Registry password |
238+
| DOCKERHUB_USERNAME | Docker Hub username |
239+
| DOCKERHUB_PASSWORD | Docker Hub password |
240+
241+
242+
End-To-End Tests
243+
================
244+
245+
The script [`./e2e/run-test.sh`](./e2e/run-test.sh) will stand up two local container registries and attempt to build all the images.
246+

0 commit comments

Comments
 (0)