Skip to content

Commit 2a3e075

Browse files
authored
[DEPLOY] HOTFIX v1.1.8
[DEPLOY] HOTFIX v1.1.8
2 parents 8a459b3 + 46de869 commit 2a3e075

1 file changed

Lines changed: 51 additions & 1 deletion

File tree

.github/workflows/cd-prod.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,54 @@ jobs:
9393
fi
9494
else
9595
echo "Less than or equal to 5 images, skipping prune."
96-
fi
96+
fi
97+
98+
deploy:
99+
needs: build-and-push-image
100+
runs-on: ubuntu-latest
101+
steps:
102+
- name: 📥 Checkout Source
103+
uses: actions/checkout@v3
104+
105+
- name: 🔒 Configure AWS Credentials
106+
uses: aws-actions/configure-aws-credentials@v4
107+
with:
108+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
109+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
110+
aws-region: ${{ secrets.AWS_REGION }}
111+
112+
- name: 📂 Download Keys and Env from S3
113+
env:
114+
REGION: ${{ secrets.AWS_REGION }}
115+
S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
116+
JWT_PUBLIC_KEY_PATH: ${{ secrets.JWT_PUBLIC_KEY_PATH }}
117+
JWT_PRIVATE_KEY_PATH: ${{ secrets.JWT_PRIVATE_KEY_PATH }}
118+
DEV_ENV_FILE_PATH: ${{ secrets.ENV_FILE_PATH_PROD }}
119+
run: |
120+
mkdir -p ./key
121+
aws s3 cp s3://$S3_BUCKET/dev/static/$JWT_PUBLIC_KEY_PATH ./key/jwt_public_key.pem --region $REGION
122+
aws s3 cp s3://$S3_BUCKET/dev/static/$JWT_PRIVATE_KEY_PATH ./key/jwt_private_key.pem --region $REGION
123+
aws s3 cp s3://$S3_BUCKET/dev/$DEV_ENV_FILE_PATH .env --region $REGION
124+
125+
- name: 🔄 Transfer Deployment Files to EC2
126+
uses: appleboy/scp-action@master
127+
with:
128+
host: ${{ secrets.HOST_PROD }}
129+
username: ec2-user
130+
key: ${{ secrets.PEM_KEY_PROD }}
131+
port: 22
132+
source: ".env,docker-compose.yml,scripts,key"
133+
target: /home/ec2-user/authentication
134+
overwrite: true
135+
136+
- name: 🚀 Remote SSH Deployment
137+
uses: appleboy/ssh-action@master
138+
with:
139+
host: ${{ secrets.HOST_PROD }}
140+
username: ec2-user
141+
key: ${{ secrets.PEM_KEY_PROD }}
142+
port: 22
143+
script: |
144+
sudo chmod +x /home/ubuntu/authentication/scripts/*.sh
145+
cd /home/ubuntu/authentication/scripts
146+
./deploy.sh

0 commit comments

Comments
 (0)