feat(ci): use dynamic repository owner and name in Docker actions (#487)

* feat(ci): use dynamic repository owner and name in Docker actions

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* feat(ci): support forks

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* feat(ci): support forks

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* feat(ci): add debug output for Docker repository information

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* feat(ci): update Docker image naming convention in workflow

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* feat(ci): set lowercase image name in Docker workflow

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* feat(ci): remove json/gha branch from Docker workflow triggers

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* feat(ci): simplify Docker registry configuration in workflow

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

---------

Signed-off-by: Jason Cameron <git@jasoncameron.dev>
This commit is contained in:
Jason Cameron 2025-05-09 20:18:53 -04:00 committed by GitHub
parent 2b103a9ec7
commit 659b577e0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 7 deletions

View File

@ -49,7 +49,7 @@ jobs:
id: meta
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
with:
images: ghcr.io/techarohq/anubis
images: ghcr.io/${{ github.repository }}
- name: Build and push
id: build
@ -58,7 +58,7 @@ jobs:
npm run container
env:
PULL_REQUEST_ID: ${{ github.event.number }}
DOCKER_REPO: ghcr.io/techarohq/anubis
DOCKER_REPO: ghcr.io/${{ github.repository }}
SLOG_LEVEL: debug
- run: |

View File

@ -27,6 +27,10 @@ jobs:
fetch-depth: 0
persist-credentials: false
- name: Set lowercase image name
run: |
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
@ -55,14 +59,14 @@ jobs:
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: ghcr.io
username: techarohq
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
with:
images: ghcr.io/techarohq/anubis
images: ${{ env.IMAGE }}
- name: Build and push
id: build
@ -70,12 +74,13 @@ jobs:
npm ci
npm run container
env:
DOCKER_REPO: ghcr.io/techarohq/anubis
DOCKER_REPO: ${{ env.IMAGE }}
SLOG_LEVEL: debug
- name: Generate artifact attestation
uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0
with:
subject-name: ghcr.io/techarohq/anubis
subject-name: ${{ env.IMAGE }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true

View File

@ -13,6 +13,7 @@ permissions:
jobs:
build:
if: github.repository == 'TecharoHQ/anubis'
runs-on: ubuntu-24.04
steps:

View File

@ -24,7 +24,7 @@ jobs:
id: meta
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
with:
images: ghcr.io/techarohq/anubis/docs
images: ghcr.io/${{ github.repository }}/docs
- name: Build and push
id: build