Merge pull request #62 from se-gam/feat/notice #122
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 Dev Server | |
on: | |
push: | |
branches: | |
- dev | |
permissions: | |
contents: read | |
jobs: | |
CD: | |
runs-on: ubuntu-latest | |
environment: development | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# - name: Create .env file | |
# run: | | |
# jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' <<< "$SECRETS_CONTEXT" > .dev.env | |
# env: | |
# SECRETS_CONTEXT: ${{ toJson(secrets) }} | |
- name: Install dependencies and build | |
run: | | |
sudo yarn install | |
sudo yarn build | |
- name: Copy build directory to server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.DEV_SERVER_ROOT }} | |
username: ${{ secrets.DEV_SERVER_USER }} | |
password: ${{ secrets.DEV_SERVER_PASSWORD }} | |
port: ${{ secrets.DEV_SERVER_PORT }} | |
script: | | |
export NVM_DIR=~/.nvm | |
source ~/.nvm/nvm.sh | |
cd /home/${{ secrets.DEV_SERVER_USER }}/segam-backend | |
git pull origin dev | |
yarn install | |
yarn db:save:dev | |
yarn build | |
dotenv -e .dev.env -- pm2 restart main |