Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pushyamig committed Aug 25, 2023
1 parent e86f26f commit 743b779
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Docker image CI
on:
push:
branches: ['dynamic_repo']
workflow_dispatch:

env:
IMAGE_TAG: latest
REPO_URL: ${{ github.repository }}
Expand All @@ -15,22 +15,24 @@ jobs:
steps:

- name: Checkout code
# uses: actions/checkout@v3
run: |
echo "BRANCH_NAME=$(basename ${{ github.ref }})" >> $GITHUB_ENV
uses: actions/checkout@v3

- name: Extract branch name
id: extract_branch
run: echo "BRANCH_NAME=$(basename ${{ github.ref }})" >> $GITHUB_ENV

# - name: build Docker image
# run: |
# docker build . --tag ghcr.io/${{ env.REPO_URL }}:${{ env.IMAGE_TAG }}-${BASE_REF}
- name: build Docker image
run: |
docker build . --tag ghcr.io/${{ env.REPO_URL }}:${{ env.IMAGE_TAG }}-${BRANCH_NAME}
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Push Docker image to GitHub Container Registry
# run: |
# docker push ghcr.io/${{ env.REPO_URL }}:${{ env.IMAGE_TAG }}-${BASE_REF}
- name: Push Docker image to GitHub Container Registry
run: |
docker push ghcr.io/${{ env.REPO_URL }}:${{ env.IMAGE_TAG }}-${BRANCH_NAME}

0 comments on commit 743b779

Please sign in to comment.