Handle permission prompts #16
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 | |
jobs: | |
build: | |
name: Build service | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: true | |
- name: Install Node.JS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.18.2 | |
- name: Install yarn globally | |
run: npm install -g yarn | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Setting up dependency Cache | |
uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: ${{ runner.os }}-yarn- | |
- name: Installing Dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn --immutable | |
- name: Build service | |
run: yarn build | |
- name: RSync deployments | |
uses: burnett01/[email protected] | |
with: | |
switches: -avzr --delete | |
path: src/ | |
remote_path: /var/www/html/ | |
remote_host: ${{ secrets.SSH_HOST }} | |
remote_user: ${{ secrets.USER_NAME }} | |
remote_key: ${{ secrets.PRIVATE_KEY }} | |
# - name: Deploy Changes | |
# run: | | |
# mkdir ~/.ssh | |
# touch ~/.ssh/known_hosts | |
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/private_key | |
# chmod 600 ~/.ssh/private_key | |
# sudo chown -v $USER ~/.ssh/known_hosts | |
# ssh-keygen -R ${{ secrets.SSH_HOST }} | |
# ls -al ~/.ssh/ | |
# # ssh-keygen -H -t rsa ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | |
# scp -i ~/.ssh/private_key -r ./dist ${{ secrets.USER_NAME }}@${{ secrets.SSH_HOST }}:/home/ec2-user/auto-presence | |
# ssh -o StrictHostKeyChecking=no -i ~/.ssh/private_key ${{ secrets.USER_NAME }}@${{ secrets.SSH_HOST}} ' | |
# ls | |
# ' |