diff --git a/.github/workflows/prod-ci-cd.yml b/.github/workflows/prod-ci-cd.yml index 2419760..6cdbcf1 100644 --- a/.github/workflows/prod-ci-cd.yml +++ b/.github/workflows/prod-ci-cd.yml @@ -14,7 +14,26 @@ on: branches: [main] jobs: + + Publish-Release: + runs-on: ubuntu-latest + steps: + - name: New Release Publish + id: new_publish + uses: release-drafter/release-drafter@v5 + with: + publish : true + env: + GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} + + outputs: + release_id: ${{ steps.new_publish.outputs.id }} + release_name: ${{ steps.new_publish.outputs.tag_name }} + + + Deploy-ECS: + needs: Publish-Release environment: prod runs-on: ubuntu-latest @@ -62,7 +81,7 @@ jobs: file: ./Dockerfile builder: ${{ steps.buildx.outputs.name }} push: true - tags: public.ecr.aws/i9y2d4u3/careplan:${{ steps.vars.outputs.branch }}_${{ steps.vars.outputs.sha_short }} + tags: public.ecr.aws/i9y2d4u3/careplan:${{ needs.Publish-Release.outputs.release_name }}_${{ needs.Publish-Release.outputs.release_id }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache @@ -79,7 +98,7 @@ jobs: with: task-definition: task-definition.json container-name: default - image: public.ecr.aws/i9y2d4u3/careplan:${{ steps.vars.outputs.branch }}_${{ steps.vars.outputs.sha_short }} + image: public.ecr.aws/i9y2d4u3/careplan:${{ needs.Publish-Release.outputs.release_name }}_${{ needs.Publish-Release.outputs.release_id }} - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v1 @@ -102,10 +121,3 @@ jobs: method: 'POST' data: '{"TaskDefinition":${{ steps.taskdefintionvar.outputs.task_definition_arn }},"Name": "${{ secrets.SERVICE_NAME }}","Replicas":1, "HealthCheckGracePeriodSeconds": 1200, "DnsPrfx": ""}' bearerToken: ${{ secrets.DUPLOCLOUD_TOKEN }} - - - name: New Release Publish - uses: release-drafter/release-drafter@v5 - with: - publish : true - env: - GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} \ No newline at end of file