Skip to content

Merge pull request #19 from kode-krew/develop #7

Merge pull request #19 from kode-krew/develop

Merge pull request #19 from kode-krew/develop #7

Workflow file for this run

name: main-deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
# 빌드
build:
runs-on: ubuntu-latest
steps:
- name: Get Github Actions IP
id: ip
uses: haythem/[email protected]
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Add Github Actions IP to Security group
run: |
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32
- name: create pem key
run: |
echo "$SSH_KEY" >> key.pem
chmod 600 key.pem
ssh -i key.pem -o StrictHostKeyChecking=no ${USER}@${HOST} "bash git-action.sh"
env:
USER: ${{secrets.USER}}
HOST: ${{secrets.HOST}}
SSH_KEY: ${{secrets.SSH_KEY}}
- name: Remove Github Actions IP From Security Group
run: |
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32