add tests and linting (#126) #275
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 AWS Lightsail | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/yarn | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Node.js and yarn | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14.x' | |
- name: Install dependencies and build app | |
run: | | |
yarn install --frozen-lockfile | |
yarn build | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.LIGHTSAIL_PRIVATE_KEY }} | |
name: lightsail | |
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_BASTION }} | |
- name: Copy build files to remote server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.LIGHTSAIL_IP }} | |
username: ${{ secrets.LIGHTSAIL_USERNAME }} | |
port: 22 | |
key: ${{ secrets.LIGHTSAIL_PRIVATE_KEY }} | |
source: '.next/*' | |
target: '/home/bitnami/apps/WiiQare-FE' | |
- name: SSH into remote server and restart the application | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.LIGHTSAIL_IP }} | |
username: ${{ secrets.LIGHTSAIL_USERNAME }} | |
port: 22 | |
key: ${{ secrets.LIGHTSAIL_PRIVATE_KEY }} | |
script: | | |
cd /home/bitnami/apps/WiiQare-FE | |
pm2 restart 0 --update-env |