mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-04-24 11:22:48 +00:00
Remove workflow
This commit is contained in:
parent
71c01fc23c
commit
ae4cf1512e
1 changed files with 0 additions and 98 deletions
98
.github/workflows/deploy.yml
vendored
98
.github/workflows/deploy.yml
vendored
|
@ -1,98 +0,0 @@
|
|||
name: Deploy PetClinic
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
description: 'Environment to deploy to'
|
||||
required: true
|
||||
default: 'dev'
|
||||
type: choice
|
||||
options:
|
||||
- dev
|
||||
- staging
|
||||
- prod
|
||||
|
||||
jobs:
|
||||
deploy-infrastructure:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ github.event.inputs.environment }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- 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: us-west-2
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v2
|
||||
|
||||
- name: Terraform Init
|
||||
working-directory: ./terraform
|
||||
run: terraform init
|
||||
|
||||
- name: Terraform Plan
|
||||
working-directory: ./terraform
|
||||
run: terraform plan -var="environment=${{ github.event.inputs.environment }}" -var="db_username=${{ secrets.DB_USERNAME }}" -var="db_password=${{ secrets.DB_PASSWORD }}" -var="vpc_id=${{ secrets.VPC_ID }}"
|
||||
|
||||
- name: Terraform Apply
|
||||
if: github.event.inputs.environment != 'prod'
|
||||
working-directory: ./terraform
|
||||
run: terraform apply -auto-approve -var="environment=${{ github.event.inputs.environment }}" -var="db_username=${{ secrets.DB_USERNAME }}" -var="db_password=${{ secrets.DB_PASSWORD }}" -var="vpc_id=${{ secrets.VPC_ID }}"
|
||||
|
||||
- name: Terraform Apply (Production - with approval)
|
||||
if: github.event.inputs.environment == 'prod'
|
||||
working-directory: ./terraform
|
||||
run: terraform apply -var="environment=${{ github.event.inputs.environment }}" -var="db_username=${{ secrets.DB_USERNAME }}" -var="db_password=${{ secrets.DB_PASSWORD }}" -var="vpc_id=${{ secrets.VPC_ID }}"
|
||||
|
||||
build-and-deploy:
|
||||
needs: deploy-infrastructure
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ github.event.inputs.environment }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
|
||||
- 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: us-west-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
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: petclinic-${{ github.event.inputs.environment }}
|
||||
IMAGE_TAG: ${{ github.sha }}
|
||||
run: |
|
||||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
||||
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
|
||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
|
||||
|
||||
- name: Deploy to ECS
|
||||
run: |
|
||||
aws ecs update-service --cluster petclinic-${{ github.event.inputs.environment }} \
|
||||
--service petclinic-service \
|
||||
--force-new-deployment
|
||||
|
||||
- name: Verify Deployment
|
||||
run: |
|
||||
echo "Waiting for deployment to complete..."
|
||||
aws ecs wait services-stable --cluster petclinic-${{ github.event.inputs.environment }} --services petclinic-service
|
Loading…
Reference in a new issue