Skip to content

Commit

Permalink
Update publish-ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
saisab29 committed Dec 11, 2024
1 parent 98bbc97 commit 0f85639
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions .github/workflows/publish-ghcr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Image CI for GHCR
name: Build and Push Docker Image

on:
workflow_run:
Expand All @@ -7,12 +7,29 @@ on:
- completed

jobs:
Build_and_publish:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build and push the image
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Log in to GHCR
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GITHUB_ACTOR }}
password: ${{ secrets.GITHUB_TOKEN }}

# Build and tag the Docker image
- name: Build Docker image
run: |
docker build -t ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest .
# Push the Docker image to GHCR
- name: Push Docker image
run: |
docker login --username saisab29 --password ${{secrets.GH_PAT}} ghcr.io
docker build . --tag ghcr.io/cardanoapi/cardanoapi.io-ghcr:latest
docker push ghcr.io/cardanoapi/cardanoapi.io-ghcr:latest
docker push ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest

0 comments on commit 0f85639

Please sign in to comment.