fix(deps): update dependency dotenv to v16.4.0 #100
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
# This workflow is run on a push on branch main | |
# | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: bot-production | |
concurrency: | |
group: deploy-production | |
cancel-in-progress: false | |
steps: | |
- name: Checkout current commit | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v3 | |
- name: Use Node.JS 18 | |
uses: actions/setup-node@d86ebcd40b3cb50b156bfa44dd277faf38282d12 # pin@v3 | |
with: | |
node-version: 18 | |
cache: "npm" | |
- name: Install npm build dependencies | |
run: npm ci | |
- name: Build the bot application | |
run: npm run build | |
- name: Remove unnecessary files for deployment | |
run: | | |
rm -rf ./src ./node_modules ./tsconfig.json ./.env.preset ./.git ./.github ./logs ./database.sqlite | |
- name: Deploy files to production server | |
uses: wlixcc/SFTP-Deploy-Action@da88a4dbe95286266bbac3c0b2b8284048d20c8f # pin@v1.2.4 | |
with: | |
server: ${{secrets.PRODUCTION_DEPLOY_SSH_HOST}} | |
port: ${{secrets.PRODUCTION_DEPLOY_SSH_PORT}} | |
username: ${{secrets.PRODUCTION_DEPLOY_SSH_USERNAME}} | |
ssh_private_key: ${{secrets.PRODUCTION_DEPLOY_SSH_KEY}} | |
local_path: './' | |
remote_path: ${{secrets.PRODUCTION_DEPLOY_SSH_REMOTE_PATH}} | |
sftpArgs: '-o ConnectTimeout=5' | |
sftp_only: true | |
- name: Restart the production bot instance | |
uses: appleboy/ssh-action@2451745138b602d3e100a6def50c8e4e39591d4c # pin@v1.0.0 | |
with: | |
host: ${{secrets.PRODUCTION_DEPLOY_SSH_HOST}} | |
port: ${{secrets.PRODUCTION_DEPLOY_SSH_PORT}} | |
username: ${{secrets.PRODUCTION_DEPLOY_SSH_USERNAME}} | |
key: ${{secrets.PRODUCTION_DEPLOY_SSH_KEY}} | |
script: | | |
cd ${{secrets.PRODUCTION_DEPLOY_SSH_REMOTE_PATH}} | |
npm ci --omit=dev | |
pm2 restart ./ecosystem.config.js --env production |