Fix cd #60
This file contains hidden or 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 AWS EC2 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| concurrency: | |
| group: deploy-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| if: github.event_name == 'push' || github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Add EC2 SSH key | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.EC2_SSH_KEY }} | |
| - name: Add EC2 host to known_hosts | |
| run: | | |
| mkdir -p ~/.ssh | |
| ssh-keyscan -H "${{ secrets.EC2_HOST }}" >> ~/.ssh/known_hosts | |
| - name: Who am I on EC2 | |
| run: | | |
| ssh "${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}" "whoami; echo \$HOME; ls -la /home/ubuntu/src/FastAPI_movie_theater | head" |