Update deploy.sh #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to EC2 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Generate SSH | |
run: | | |
mkdir -p $HOME/.ssh | |
ssh-keygen -t rsa -b 2048 -f $HOME/.ssh/id_rsa -N "" | |
cat $HOME/.ssh/id_rsa.pub | |
- name: Setup ssh | |
run: | | |
aws ec2-instance-connect send-ssh-public-key \ | |
--instance-id i-0a057bcf1bd8b8212 \ | |
--ssh-public-key file://$HOME/.ssh/id_rsa.pub --instance-os-user root | |
- name: Deploy to EC2 | |
run: | | |
aws ec2-instance-connect ssh --instance-id i-0a057bcf1bd8b8212 --connection-type eice | |
- name: Run BE | |
run: | | |
bash befastapi/Moodle_VirtualAssistant_BE/deploy.sh |