Skip to content

Commit a2116ef

Browse files
committed
chore: update Docker Hub namespace and improve credential validation
1 parent 52e4e2d commit a2116ef

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.github/workflows/docker.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
env:
1010
REGISTRY: docker.io
1111
IMAGE_NAME: dev-to-mcp
12+
DOCKERHUB_NAMESPACE: nickytonline
1213

1314
jobs:
1415
build:
@@ -43,12 +44,9 @@ jobs:
4344

4445
- name: Validate Docker Hub secrets
4546
run: |
46-
echo "username length: ${#DOCKERHUB_USERNAME}"
47-
echo "token length: ${#DOCKERHUB_TOKEN}"
48-
if [ -z "$DOCKERHUB_USERNAME" ] || [ -z "$DOCKERHUB_TOKEN" ]; then
49-
echo "Missing Docker credentials"
50-
exit 1
51-
fi
47+
set -euo pipefail
48+
: "${DOCKERHUB_USERNAME:?Missing Docker credentials}"
49+
: "${DOCKERHUB_TOKEN:?Missing Docker credentials}"
5250
env:
5351
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
5452
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -67,16 +65,17 @@ jobs:
6765
file: Dockerfile
6866
push: true
6967
tags: |
70-
${{ env.REGISTRY }}/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
71-
${{ env.REGISTRY }}/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
68+
${{ env.REGISTRY }}/${{ env.DOCKERHUB_NAMESPACE }}/${{ env.IMAGE_NAME }}:latest
69+
${{ env.REGISTRY }}/${{ env.DOCKERHUB_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
7270
cache-from: type=gha
7371
cache-to: type=gha,mode=max
7472

7573
- name: Update Docker Hub description + short desc
74+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
7675
uses: peter-evans/dockerhub-description@v3
7776
with:
7877
username: ${{ secrets.DOCKERHUB_USERNAME }}
7978
password: ${{ secrets.DOCKERHUB_TOKEN }}
80-
repository: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
79+
repository: ${{ env.DOCKERHUB_NAMESPACE }}/${{ env.IMAGE_NAME }}
8180
readme-filepath: ./README.md
82-
short-description: ${{ github.event.repository.description || '' }}
81+
short-description: MCP server for the dev.to API (no auth).

0 commit comments

Comments
 (0)