Skip to content

Commit ff2ed91

Browse files
committed
[feature/#366] 변경사항 production 적용
1 parent eca5444 commit ff2ed91

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

.github/workflows/depoly-production.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,25 @@ jobs:
2828
- name: Build with Gradle
2929
run: ./gradlew build
3030

31+
- name: Get GitHub Actions IP
32+
id: ip
33+
uses: haythem/public-ip@v1.3
34+
35+
- name: Configure AWS credentials
36+
uses: aws-actions/configure-aws-credentials@v5.1.1
37+
with:
38+
aws-access-key-id: ${{ secrets.AWS_USER_ACCESS_KEY }}
39+
aws-secret-access-key: ${{ secrets.AWS_USER_SECRET_KEY }}
40+
aws-region: ap-northeast-2
41+
42+
- name: Add GitHub IP to Security Group
43+
run: |
44+
aws ec2 authorize-security-group-ingress \
45+
--group-id ${{ secrets.AWS_SECURITY_GROUP_ID }} \
46+
--protocol tcp \
47+
--port 22 \
48+
--cidr ${{ steps.ip.outputs.ipv4 }}/32
49+
3150
- name: copy file via ssh
3251
uses: appleboy/scp-action@master
3352
with:
@@ -68,4 +87,13 @@ jobs:
6887
passphrase: ${{ secrets.IBAS_PROD_PASSWORD }}
6988
# port: ${{ secrets.PORT }} # default : 22
7089
script: |
71-
bash ${{ secrets.IBAS_PROD_DEPLOY_PATH }}/deploy.sh
90+
bash ${{ secrets.IBAS_PROD_DEPLOY_PATH }}/deploy.sh
91+
92+
- name: Remove GitHub IP from Security Group
93+
if: always()
94+
run: |
95+
aws ec2 revoke-security-group-ingress \
96+
--group-id ${{ secrets.AWS_SECURITY_GROUP_ID }} \
97+
--protocol tcp \
98+
--port 22 \
99+
--cidr ${{ steps.ip.outputs.ipv4 }}/32

0 commit comments

Comments
 (0)