Skip to content

Instantly share code, notes, and snippets.

@StoneyEagle
Created November 21, 2022 11:01
Show Gist options
  • Save StoneyEagle/782b61c345a5ff44e0977a5fcb7c5394 to your computer and use it in GitHub Desktop.
Save StoneyEagle/782b61c345a5ff44e0977a5fcb7c5394 to your computer and use it in GitHub Desktop.
Digital Ocean deploy script
/* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/no-var-requires */
const { readFileSync } = require('fs');
const { Client } = require('node-scp');
const { join } = require('path');
const env = require('dotenv');
env.config();
Client({
host: process.env.DO_HOST,
port: 22,
username: process.env.DO_USER,
privateKey: readFileSync(join(process.env.USERPROFILE, '.ssh', process.env.DO_KEYFILE)),
passphrase: process.env.DO_PASS,
}).then((client) => {
client.uploadDir(join(__dirname, '..', '..', 'dist', 'app'), '/root/stack/beta')
.then(() => {
client.close();
})
.catch((error) => {
console.log(error);
});
})
.catch(e => console.log(e));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment