Skip to content

Commit

Permalink
⚙️ chore: github ip를 ag에 추가 및 제거 하는 작업 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jinddings committed Nov 7, 2024
1 parent 45c31ae commit 1d7608f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ jobs:
docker push ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}
docker push ${{ env.DOCKER_IMAGE }}:latest
- name: Get Github Actions IP
id: ip
uses: haythem/[email protected]

- name: Setting NCP CLI & Credentials
run: |
cd ~
wget https://www.ncloud.com/api/support/download/5/65
unzip 65
mkdir ~/.ncloud
echo -e "[DEFAULT]\nncloud_access_key_id = ${{ secrets.NCP_ACCESS_KEY }}\nncloud_secret_access_key = ${{ secrets.NCP_SECRET_KEY }}\nncloud_api_url = ${{ secrets.NCP_API_URI }}" >> ~/.ncloud/configure
- name: Add Github Action Ip to Security group
run: |
chmod -R 777 ~/cli_linux
cd ~/cli_linux
./ncloud vserver addAccessControlGroupInboundRule --regionCode KR --vpcNo ${{ secrets.NCP_VPC_ID }} --accessControlGroupNo ${{ secrets.NCP_ACG_ID }} --accessControlGroupRuleList "protocolTypeCode='TCP', ipBlock='${{ steps.ip.outputs.ipv4 }}/32', portRange='${{ secrets.SSH_PORT }}'"
- name: Deploy to NCP Server
uses: appleboy/ssh-action@master
with:
Expand All @@ -80,3 +98,9 @@ jobs:
--name juga-docker \
-p 3000:3000 \
${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}
- name: Remove Github Action Ip to Security group
run: |
chmod -R 777 ~/cli_linux
cd ~/cli_linux
./ncloud vserver removeAccessControlGroupInboundRule --regionCode KR --vpcNo ${{ secrets.NCP_VPC_ID }} --accessControlGroupNo ${{ secrets.NCP_ACG_ID }} --accessControlGroupRuleList "protocolTypeCode='TCP', ipBlock='${{ steps.ip.outputs.ipv4 }}/32', portRange='${{ secrets.SSH_PORT }}'"

0 comments on commit 1d7608f

Please sign in to comment.