Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/main.yml
  • Loading branch information
dadyan4 committed Dec 20, 2024
1 parent 7d409cd commit e16b885
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
- name: Set Version, Build Number, and Repository Name
id: set_version
run: |
VERSION="1.0.0"
IMAGE_NAME="${{ secrets.DOCKERHUB_USERNAME }}/karos-repo"
VERSION="prod_"
REPO_NAME="${{ github.repository }}" # Fetch the full repository name (owner/repo)
REPO_NAME_ONLY=$(echo $REPO_NAME | cut -d '/' -f 2) # Extract just the repo name (after /)
BUILD_NUMBER=${{ github.run_number }}
REPO_NAME="${{ github.repository }}" # Fetch repository name
# Check if the version already exists on Docker Hub
if docker pull $IMAGE_NAME:$VERSION 2>/dev/null; then
if docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${REPO_NAME_ONLY}:$VERSION 2>/dev/null; then
# Extract the current major and minor version
MAJOR=$(echo $VERSION | cut -d '.' -f 1)
MINOR=$(echo $VERSION | cut -d '.' -f 2)
Expand All @@ -37,8 +37,8 @@ jobs:
VERSION="$MAJOR.$MINOR.$PATCH"
fi
# Combine version, build number, and repository name
TAG="$REPO_NAME-$VERSION-build.$BUILD_NUMBER"
# Combine version and build number
TAG="$REPO_NAME_ONLY:$VERSION-build.$BUILD_NUMBER"
# Export variables
echo "VERSION=$VERSION" >> $GITHUB_ENV
Expand All @@ -49,7 +49,7 @@ jobs:
run: |
docker build . \
--file Dockerfile \
--tag ${{ secrets.DOCKERHUB_USERNAME }}/karos-repo:${{ env.TAG }}
--tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.TAG }}
- name: Docker Push
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/karos-repo:${{ env.TAG }}
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.TAG }}

0 comments on commit e16b885

Please sign in to comment.