Skip to content

Commit 04b5326

Browse files
committed
changed to docker hub
1 parent 815c943 commit 04b5326

1 file changed

Lines changed: 10 additions & 18 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- name: Checkout code
14+
- name: Checkout
1515
uses: actions/checkout@v4
1616

1717
- name: Setup Python
@@ -20,7 +20,7 @@ jobs:
2020
python-version: "3.12"
2121
cache: "pip"
2222

23-
- name: Install deps
23+
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
2626
pip install -r requirements.txt
@@ -31,40 +31,32 @@ jobs:
3131
- name: Pytest (tests)
3232
run: pytest -q
3333

34+
3435
docker:
3536
name: Docker Build (+ Push on main)
3637
runs-on: ubuntu-latest
3738
needs: ci
38-
env:
39-
IMAGE: ghcr.io/placeholder
40-
41-
permissions:
42-
contents: read
43-
packages: write
4439

4540
steps:
46-
- name: Checkout code
41+
- name: Checkout
4742
uses: actions/checkout@v4
4843

4944
- name: Setup Docker Buildx
5045
uses: docker/setup-buildx-action@v3
5146

52-
- name: Set lowercase image name
53-
run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
54-
55-
- name: Login to GHCR
47+
# Login only for main pushes (not PRs)
48+
- name: Login to Docker Hub
5649
if: github.event_name == 'push'
5750
uses: docker/login-action@v3
5851
with:
59-
registry: ghcr.io
60-
username: ${{ github.actor }}
61-
password: ${{ secrets.GITHUB_TOKEN }}
52+
username: ${{ secrets.DOCKERHUB_USERNAME }}
53+
password: ${{ secrets.DOCKERHUB_TOKEN }}
6254

6355
- name: Build (PR) or Build+Push (main)
6456
uses: docker/build-push-action@v6
6557
with:
6658
context: .
6759
push: ${{ github.event_name == 'push' }}
6860
tags: |
69-
${{ env.IMAGE }}:latest
70-
${{ env.IMAGE }}:${{ github.sha }}
61+
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
62+
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ github.sha }}

0 commit comments

Comments
 (0)