diff --git a/.github/workflows/ci-cd-typescript.yml b/.github/workflows/ci-cd-typescript.yml index 3849a80..a4afe23 100644 --- a/.github/workflows/ci-cd-typescript.yml +++ b/.github/workflows/ci-cd-typescript.yml @@ -69,16 +69,17 @@ jobs: - name: Check if perform release id: perform_release run: | - if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == "refs/heads/develop" || "${GITHUB_REF}" == "refs/heads/aks-dev" ]]; then - echo "PERFORM_RELEASE=true" >> $GITHUB_ENV + if [[ "${{ github.ref_name }}" == "${{ github.event.repository.default_branch }}" || "${{ github.ref_name }}" == "development" || "${{ github.ref_name }}" == "aks-dev" ]]; then + PERFORM_RELEASE=true elif [[ "${GITHUB_EVENT_NAME}" == "push" && ( "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == refs/tags/* ) ]]; then - echo "PERFORM_RELEASE=true" >> $GITHUB_ENV + PERFORM_RELEASE=true elif [[ "${{ inputs.performRelease }}" == "true" ]]; then - echo "PERFORM_RELEASE=true" >> $GITHUB_ENV + PERFORM_RELEASE=true else - echo "PERFORM_RELEASE=false" >> $GITHUB_ENV + PERFORM_RELEASE=false fi - echo "Perform release condition: PERFORM_RELEASE" + echo "PERFORM_RELEASE=$PERFORM_RELEASE" >> $GITHUB_ENV + echo "Perform release: $PERFORM_RELEASE" - name: Lowercase Docker Image Name run: | @@ -90,7 +91,8 @@ jobs: with: images: ${{ env.IMAGE_NAME }} tags: | - type=edge,branch=main + type=raw,value=prod,enable={{is_default_branch}} + type=raw,value=dev,enable=${{ github.ref == 'refs/heads/development' }} type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} @@ -120,6 +122,12 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Debug metadata outputs + if: env.PERFORM_RELEASE == 'true' + run: | + echo "Meta tags: ${{ steps.meta.outputs.tags }}" + echo "Meta labels: ${{ steps.meta.outputs.labels }}" + echo "IMAGE_NAME: ${{ env.IMAGE_NAME }}" - name: Build and push if: env.PERFORM_RELEASE == 'true' @@ -128,5 +136,5 @@ jobs: context: . push: true target: "${{ env.PRODUCTION_STAGE }}" - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}