diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 7b6929e..a11103d 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -8,6 +8,10 @@ on: branches: - main +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: false + jobs: build: runs-on: ubuntu-latest @@ -20,7 +24,7 @@ jobs: - name: Checkout Code uses: actions/checkout@v3 with: - fetch-depth: 0 # Fetch full history for branch info + fetch-depth: 0 # Full history for branch info - name: Validate Conventional Commits id: validate_commits @@ -31,20 +35,22 @@ jobs: echo "valid=false" >> $GITHUB_ENV fi - # Only run semantic version calculation if commit message is valid + - name: Determine Branch Name + run: | + echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + - name: Calculate Semantic Version tag if: env.valid == 'true' id: semver uses: gandarez/semver-action@v2.0.0 with: main_branch_name: main - source_branch: ${{ github.head_ref || github.ref }} + source_branch: ${{ env.BRANCH_NAME }} - name: Extract Variables if: env.valid == 'true' run: | echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV echo "SEMVER_TAG=${{ steps.semver.outputs.semver_tag }}" >> $GITHUB_ENV - name: Docker Login