From ee44fbe600d3766e354517f1a72256ddcdb7bafa Mon Sep 17 00:00:00 2001 From: Yong woo Song Date: Tue, 30 Jan 2024 21:41:44 +0900 Subject: [PATCH] [#3] feat: Add ECR push to workflow --- .github/workflows/deploy.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..1715c51 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,32 @@ +name: Deploy to ECR + +on: + push: + tags: + - v* + workflow_dispatch: + +jobs: + build: + name: Build Image + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Set RELEASE_VERSION + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ap-northeast-2 + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + - name: Build, tag, and push image to Amazon ECR + run: | + docker build -t dnd-10th-2-backend-springboot . + docker tag dnd-10th-2-backend-springboot:${{ env.RELEASE_VERSION }} public.ecr.aws/g8f7f0e2/dnd-10th-2-backend:${{ env.RELEASE_VERSION }} + docker push public.ecr.aws/g8f7f0e2/dnd-10th-2-backend:${{ env.RELEASE_VERSION }} +