diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml index 1ef62f5a3..8fff6b17d 100644 --- a/.github/workflows/aws.yml +++ b/.github/workflows/aws.yml @@ -29,9 +29,6 @@ jobs: deploy: name: Build & Deploy runs-on: ubuntu-latest - environment: - name: staging - url: https://stage.appointment.day steps: - name: Checkout @@ -50,7 +47,7 @@ jobs: with: mask-password: 'true' - - name: Build, tag, and push backend to Amazon ECR + - name: Build, tag, and push backend image to Amazon ECR id: build-backend env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} @@ -62,19 +59,6 @@ jobs: docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./backend -f ./backend/deploy.dockerfile docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG echo "image_backend=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT - - - name: Build, tag, and push frontend to Amazon ECR - id: build-frontend - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: frontend-${{ github.sha }} - run: | - # Build a docker container and - # push it to ECR so that it can - # be deployed to ECS. - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./frontend -f ./frontend/deploy.dockerfile - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - echo "image_frontend=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT - name: Fill in the new backend image ID in the Amazon ECS task definition id: task-def-backend @@ -85,18 +69,7 @@ jobs: image: ${{ steps.build-backend.outputs.image_backend }} environment-variables: "RELEASE_VERSION=${{ github.sha }}" - - name: Fill in the new frontend image ID in the Amazon ECS task definition - id: task-def-frontend - uses: aws-actions/amazon-ecs-render-task-definition@v1 - with: - task-definition: ${{ steps.task-def-backend.outputs.task-definition }} - container-name: ${{ env.CONTAINER_FRONTEND }} - image: ${{ steps.build-frontend.outputs.image_frontend }} - - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v1 with: - task-definition: ${{ steps.task-def-frontend.outputs.task-definition }} - service: ${{ env.ECS_SERVICE }} - cluster: ${{ env.ECS_CLUSTER }} - wait-for-service-stability: true + task-definition: ${{ steps.task-def-backend.outputs.task-definition }} diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/iac_plan.yaml b/.github/workflows/iac_plan.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/iac_validate.yaml b/.github/workflows/iac_validate.yaml new file mode 100644 index 000000000..49acd0991 --- /dev/null +++ b/.github/workflows/iac_validate.yaml @@ -0,0 +1,26 @@ +name: validate-iac +on: + push: + workflow_call: +env: + tf_version: '1.6.2' + tg_version: '0.55.15' + environment: 'stage' + +jobs: + validate-iac: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: opentofu/setup-opentofu@v1 + with: + tofu_version: ${{ env.tf_version }} + - run: | + git clone --depth 1 --branch main https://github.com/tgenv/tgenv.git ~/.tgenv + sudo ln -s ~/.tgenv/bin* /usr/local/bin + tgenv install ${{ env.tg_version }} + - run: | + cd ./tofu/environments/${{ env.environment }}/terraform/tfbackend + terragrun init + terragrunt validate + diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 000000000..e69de29bb