diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 1272812..fd512e7 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -38,33 +38,34 @@ jobs: - name: Preparing job run: | TAG_NAME=${GITHUB_REF#refs/tags/} - + # Validate and sanitize the tag name if [[ ! "$TAG_NAME" =~ ^[a-z0-9]+([._-][a-z0-9]+)*$ ]]; then - echo "# ❌ Invalid tag name: $TAG_NAME. Tag names must be lowercase and can include dashes, dots, or underscores." >> $GITHUB_STEP_SUMMARY + echo "# ❌ Invalid tag name: $TAG_NAME. Tag names must be lowercase and can include dashes, dots, or underscores." >> $GITHUB_STEP_SUMMARY exit 1 fi - + # Ensure tag name is a valid Docker tag if [ ${#TAG_NAME} -gt 128 ]; then - echo "# ❌ Tag name is too long. Must be less than 128 characters.">> $GITHUB_STEP_SUMMARY + echo "# ❌ Tag name is too long. Must be less than 128 characters." >> $GITHUB_STEP_SUMMARY exit 1 fi - + TAG_COMMIT_SHA=$(git rev-list -n 1 $TAG_NAME) echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV echo "TAG_COMMIT_SHA=$TAG_COMMIT_SHA" >> $GITHUB_ENV echo "SHA_SHORT=$(echo $TAG_COMMIT_SHA | cut -c1-7)" >> $GITHUB_ENV - - echo "Tag Name: ${{ env.TAG_NAME }}" - echo "Full SHA: ${{ env.TAG_COMMIT_SHA }}" - echo "Short SHA: ${{ env.SHA_SHORT }} - + + echo "Tag Name: $TAG_NAME" + echo "Full SHA: $TAG_COMMIT_SHA" + echo "Short SHA: $(echo $TAG_COMMIT_SHA | cut -c1-7)" + echo "IMAGE_DEV=docker.artifactory.d3d.io/${{ env.ARTIFACT_NAME }}:${{ env.SHA_SHORT }}" >> $GITHUB_ENV echo "IMAGE_QA=docker.artifactory.d3d.io/${{ env.ARTIFACT_NAME }}:${{ env.TAG_NAME }}" >> $GITHUB_ENV - + echo "DEV: ${{ env.IMAGE_DEV }}" echo "QA: ${{ env.IMAGE_QA }}" + build_test_and_deploy_dev: runs-on: ubuntu-latest