feat: get all post by author id #68
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: Push-to-EC2 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
name: Deploy to EC2 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout files | |
uses: actions/checkout@v3 | |
- name: Using Node.js 20.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20.x" | |
registry-url: "https://registry.npmjs.org" | |
- name: Install dependencies | |
run: npm install | |
- name: Build the app | |
run: npm run build | |
- name: Copy files with SSH | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{secrets.EC2_KEY}} | |
ARGS: "-rltgoDzvO --delete" | |
SOURCE: "./" | |
REMOTE_HOST: ${{secrets.EC2_HOST}} | |
REMOTE_USER: ${{secrets.EC2_USERNAME}} | |
TARGET: "~/app" | |
EXCLUDE: "/node_modules/, **.env, rebuild_app.sh, watcher.sh" | |
with: | |
script: "pm2 restart all" | |
- name: Restart Server | |
env: | |
PRIVATE_KEY: ${{ secrets.EC2_KEY }} | |
HOSTNAME: ${{secrets.EC2_HOST}} | |
USER_NAME: ${{secrets.EC2_USERNAME}} | |
run: | | |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key | |
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} ' | |
export HOME=/home/ubuntu | |
export PATH=$PATH:/home/ubuntu/.nvm/versions/node/v20.11.1/bin | |
cd /home/ubuntu/app | |
npm install | |
/home/ubuntu/.nvm/versions/node/v20.11.1/bin/pm2 restart all | |
' |