Refactor User Authentication Strategies #48
Workflow file for this run
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Ubuntu server deploy | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
workflow_dispatch: | |
jobs: | |
build: | |
if: false | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Create config.test.json | |
run: echo '${{ secrets.CONFIG_TEST_JSON }}' > src/configs/config.test.json | |
- name: Create .env.test | |
run: echo '${{ '' }}' > src/.env.test | |
- name: Install dependencies | |
run: npm install | |
- name: Run tests | |
run: npm test | |
- name: Deploy | |
if: github.event_name == 'push' && success() | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_KEY }} # SSH_KEY is the private key of the ubuntu server, public key must go to authorized_keys file | |
script: | | |
cd /var/www/commitstreams-server | |
export NVM_DIR=~/.nvm | |
source ~/.nvm/nvm.sh | |
# verifies the right Node.js version is in the environment | |
node -v # should print `v20.12.2` | |
# verifies the right NPM version is in the environment | |
npm -v # should print `10.5.0` | |
source ~/.bashrc | |
git pull origin main | |
npm install | |
npm run stop:prod | |
npm run start:prod |