Manual deployment via scp

This commit is contained in:
Alexander Nozik 2021-10-31 16:20:14 +03:00
parent 2e408b1c40
commit 5120e4042c
4 changed files with 59 additions and 17 deletions

View File

@ -18,14 +18,5 @@ jobs:
yarn
gatsby build
- name: Publish to server via scp
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
port: ${{ secrets.PORT }}
username: ${{ secrets.WEBMASTER_USERNAME }}
password: ${{ secrets.WEBMASTER_PASSWORD }}
# key: ${{ secrets.NPM_GITHUB_PRIVATE_KEY }}
source: "public/*"
target: "/home/webmaster/html"
overwrite: 1
strip_components: 1
run: |
yarn run deploy ${{ secrets.WEBMASTER_USERNAME }} ${{ secrets.WEBMASTER_PASSWORD }}

24
deploy.js Normal file
View File

@ -0,0 +1,24 @@
const { Client } = require('node-scp')
let remotePath = "/var/www/html"
let args = process.argv.slice(2);
async function deploy() {
try {
console.log("Starting scp upload")
const client = await Client({
host: 'npm.mipt.ru',
port: 22,
username: args[0],
password: args[1],
})
await client.emptyDir(remotePath)
await client.uploadDir('./public', remotePath)
client.close() // remember to close connection after you finish
} catch (e) {
console.log(e)
}
}
deploy().then(r => console.log("Deploy is finished"))

View File

@ -2,7 +2,7 @@
"name": "npm-site",
"private": true,
"description": "Nuclear Physics Methods laboratory",
"version": "0.2.0",
"version": "0.2.1",
"dependencies": {
"bootstrap": "4.6.0",
"breakpoints": "^0.0.0",
@ -40,7 +40,8 @@
"react-scrollspy": "^3.4.3",
"redux": "4.0.5",
"smoothscroll-polyfill": "^0.4.4",
"vertical-timeline-component-for-react": "1.0.7"
"vertical-timeline-component-for-react": "1.0.7",
"node-scp": "0.0.15"
},
"devDependencies": {
"autoprefixer": "10.2.5",
@ -67,7 +68,8 @@
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1",
"deploy": "node deploy.js"
},
"repository": {
"type": "git",

View File

@ -3041,7 +3041,7 @@ arrify@^2.0.1:
resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa"
integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==
asn1@~0.2.3:
asn1@^0.2.4, asn1@~0.2.3:
version "0.2.4"
resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136"
integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==
@ -3339,7 +3339,7 @@ batch@0.6.1:
resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16"
integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=
bcrypt-pbkdf@^1.0.0:
bcrypt-pbkdf@^1.0.0, bcrypt-pbkdf@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"
integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=
@ -4540,6 +4540,13 @@ cosmiconfig@^7.0.0:
path-type "^4.0.0"
yaml "^1.10.0"
cpu-features@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/cpu-features/-/cpu-features-0.0.2.tgz#9f636156f1155fd04bdbaa028bb3c2fbef3cea7a"
integrity sha512-/2yieBqvMcRj8McNzkycjW2v3OIUOibBfd2dLEJ0nWts8NobAxwiyw9phVNS6oDL8x8tz9F7uNVFEVpJncQpeA==
dependencies:
nan "^2.14.1"
create-gatsby@^1.14.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/create-gatsby/-/create-gatsby-1.14.0.tgz#ce38df717461757fb6b775e656106c43b55a0f71"
@ -10764,7 +10771,7 @@ mute-stream@0.0.8, mute-stream@~0.0.4:
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==
nan@^2.12.1, nan@^2.13.2:
nan@^2.12.1, nan@^2.13.2, nan@^2.14.1, nan@^2.15.0:
version "2.15.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee"
integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==
@ -10964,6 +10971,13 @@ node-sass@^5.0.0:
stdout-stream "^1.4.0"
"true-case-path" "^1.0.2"
node-scp@0.0.15:
version "0.0.15"
resolved "https://registry.yarnpkg.com/node-scp/-/node-scp-0.0.15.tgz#e49aa669169f2cc0335dc95d0bef7a7fd6da5822"
integrity sha512-iQQpzVqsczdM35tI5JzFkM3DFMJb2VIeHGBVXU9d5EIgSrP4HGE44SScGv83D5aEtYCaY2r5uR1bPhUQwp6hRg==
dependencies:
ssh2 "^1.1.0"
nopt@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88"
@ -14030,6 +14044,17 @@ squeak@^1.0.0:
console-stream "^0.1.1"
lpad-align "^1.0.1"
ssh2@^1.1.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/ssh2/-/ssh2-1.5.0.tgz#4dc559ba98a1cbb420e8d42998dfe35d0eda92bc"
integrity sha512-iUmRkhH9KGeszQwDW7YyyqjsMTf4z+0o48Cp4xOwlY5LjtbIAvyd3fwnsoUZW/hXmTCRA3yt7S/Jb9uVjErVlA==
dependencies:
asn1 "^0.2.4"
bcrypt-pbkdf "^1.0.2"
optionalDependencies:
cpu-features "0.0.2"
nan "^2.15.0"
sshpk@^1.7.0:
version "1.16.1"
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877"