Skip to content

Commit 57144fc

Browse files
author
Kyle Spengler
committed
fix: publish image to GHCR (login + lowercase owner)
1 parent f350776 commit 57144fc

File tree

1 file changed

+13
-49
lines changed

1 file changed

+13
-49
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,37 @@
1-
name: Release (Build & Push Image)
1+
name: Release Image (GHCR)
22

33
on:
44
push:
55
tags:
6-
- 'v*' # e.g. v0.1.0
7-
workflow_dispatch:
6+
- 'v*'
87

98
permissions:
109
contents: read
11-
packages: write # required for GHCR
10+
packages: write
1211

1312
jobs:
14-
ghcr:
13+
docker:
1514
runs-on: ubuntu-latest
1615
steps:
1716
- uses: actions/checkout@v4
17+
- uses: docker/setup-buildx-action@v3
1818

19-
- name: Compute image name & tag
20-
id: prep
21-
run: |
22-
REPO_LC=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
23-
echo "repo_lc=$REPO_LC" >> $GITHUB_OUTPUT
24-
TAG="${{ github.ref_name }}"
25-
echo "tag=$TAG" >> $GITHUB_OUTPUT
19+
# GHCR needs lowercase owner (your account is KyleSDeveloper)
20+
- name: Lowercase owner
21+
run: echo "OWNER_LC=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV
2622

2723
- name: Login to GHCR
2824
uses: docker/login-action@v3
2925
with:
3026
registry: ghcr.io
31-
username: ${{ github.actor }}
27+
username: ${{ env.OWNER_LC }}
3228
password: ${{ secrets.GITHUB_TOKEN }}
3329

34-
- name: Set up Buildx
35-
uses: docker/setup-buildx-action@v3
36-
37-
- name: Build & Push (GHCR)
38-
uses: docker/build-push-action@v6
39-
with:
40-
context: .
41-
push: true
42-
tags: |
43-
ghcr.io/${{ steps.prep.outputs.repo_lc }}:${{ steps.prep.outputs.tag }}
44-
ghcr.io/${{ steps.prep.outputs.repo_lc }}:latest
45-
cache-from: type=gha
46-
cache-to: type=gha,mode=max
47-
48-
dockerhub:
49-
if: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
50-
runs-on: ubuntu-latest
51-
steps:
52-
- uses: actions/checkout@v4
53-
54-
- name: Prep tag
55-
id: prep
56-
run: echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
57-
58-
- name: Login to Docker Hub
59-
uses: docker/login-action@v3
60-
with:
61-
username: ${{ secrets.DOCKERHUB_USERNAME }}
62-
password: ${{ secrets.DOCKERHUB_TOKEN }}
63-
64-
- name: Build & Push (Docker Hub)
65-
uses: docker/build-push-action@v6
30+
- name: Build & push
31+
uses: docker/build-push-action@v5
6632
with:
6733
context: .
6834
push: true
6935
tags: |
70-
${{ secrets.DOCKERHUB_USERNAME }}/serving-app:${{ steps.prep.outputs.tag }}
71-
${{ secrets.DOCKERHUB_USERNAME }}/serving-app:latest
72-
cache-from: type=gha
73-
cache-to: type=gha,mode=max
36+
ghcr.io/${{ env.OWNER_LC }}/serving_app:${{ github.ref_name }}
37+
ghcr.io/${{ env.OWNER_LC }}/serving_app:latest

0 commit comments

Comments
 (0)