fix: deployment scripts and index.ts problems
This commit is contained in:
parent
2fd544c0a7
commit
e950e7ea8e
4 changed files with 54 additions and 17 deletions
4
.github/workflows/ssh-deploy.yml
vendored
4
.github/workflows/ssh-deploy.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
name: SSH Deploy
|
name: SSH Deploy Staged
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -20,4 +20,4 @@ jobs:
|
||||||
- name: SSH and run deployment script
|
- name: SSH and run deployment script
|
||||||
run: |
|
run: |
|
||||||
ssh -i ~/.ssh/id_ed25519 ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \
|
ssh -i ~/.ssh/id_ed25519 ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \
|
||||||
'cd ${{ secrets.SOURCE_DIR }} && git pull && sh ./deploy.sh ${{ secrets.SOURCE_DIR }} ${{ secrets.HTML_DIR }}'
|
'sh ./stage.sh'
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ async function loadSheet() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lects = rows.shift()?.split('\t');
|
const lect_names = rows.shift()?.split('\t');
|
||||||
|
|
||||||
const keys = rows.map(row=>row.split('\t')[0]?.split(';')[0]);
|
const keys = rows.map(row=>row.split('\t')[0]?.split(';')[0]);
|
||||||
console.log(keys);
|
console.log(keys);
|
||||||
|
|
@ -117,25 +117,44 @@ async function loadSheet() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lects) {
|
if (!lect_names) {
|
||||||
console.error("No lects found");
|
console.error("No lects found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const lect of lects) {
|
const lects = Array<Lect>();
|
||||||
|
|
||||||
|
for (const lect of lect_names) {
|
||||||
let l = new Lect();
|
let l = new Lect();
|
||||||
l.name = lect;
|
l.name = lect;
|
||||||
l.save();
|
l.save();
|
||||||
|
lects.push(l)
|
||||||
console.log(l);
|
console.log(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nikolect = lects.indexOf("Nikomiko");
|
|
||||||
const lemmas = Array<Lemma>();
|
const lemmas = Array<Lemma>();
|
||||||
|
|
||||||
for (let i = 0; i < rows.length; i++) {
|
for (let i = 0; i < rows.length; i++) {
|
||||||
const row = rows[i]?.split('\t');
|
const row = rows[i]?.split('\t');
|
||||||
|
const lect_name = lect_names[i];
|
||||||
|
|
||||||
|
if(!lect_name){
|
||||||
|
console.error("No lect name");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!row){
|
||||||
|
console.error("Row doesn't exist");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(row.length !== lect_names.length){
|
||||||
|
console.error("Mismatched row size");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lemma_key = row[0];
|
||||||
|
|
||||||
// todo
|
|
||||||
const lemma_key = null;
|
|
||||||
const lemma = new Lemma();
|
const lemma = new Lemma();
|
||||||
|
|
||||||
if (lemma_key == null || lemma_key.length == 0) {
|
if (lemma_key == null || lemma_key.length == 0) {
|
||||||
|
|
@ -151,12 +170,15 @@ async function loadSheet() {
|
||||||
lemmas.push(lemma);
|
lemmas.push(lemma);
|
||||||
lemma.word_forms = Array<WordForm>();
|
lemma.word_forms = Array<WordForm>();
|
||||||
|
|
||||||
for (let i = 0; i < row.length; i++) {
|
for (let j = 0; j < row.length; j++) {
|
||||||
const cell = row?.[i];
|
const cell = row?.[j];
|
||||||
|
const lect = lects[j];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
cell === null ||
|
cell === null ||
|
||||||
cell === undefined ||
|
cell === undefined ||
|
||||||
(typeof cell === "string" && cell.length === 0)
|
(typeof cell === "string" && cell.length === 0) ||
|
||||||
|
!lect
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +186,7 @@ async function loadSheet() {
|
||||||
for (let word_form of cell.split(";")) {
|
for (let word_form of cell.split(";")) {
|
||||||
const f = new WordForm();
|
const f = new WordForm();
|
||||||
f.word_form = word_form;
|
f.word_form = word_form;
|
||||||
f.lect = lects[i];
|
f.lect = lect;
|
||||||
lemma.word_forms.push(f);
|
lemma.word_forms.push(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
deploy.sh
13
deploy.sh
|
|
@ -3,11 +3,14 @@
|
||||||
#
|
#
|
||||||
# Deployment script to be run remotely on push to master at https://github.com/ViossaDiskordServer/ViossaDotNet/
|
# Deployment script to be run remotely on push to master at https://github.com/ViossaDiskordServer/ViossaDotNet/
|
||||||
#
|
#
|
||||||
# Usage: sh ./deploy.sh SOURCE_DIR STATIC_DIRECTORY
|
# Usage: sh ./deploy.sh SOURCE_DIR STATIC_DIR BACKEND_DIR
|
||||||
#
|
#
|
||||||
|
|
||||||
pwd
|
SOURCE_DIR=$1
|
||||||
cd $1/apps/vdn-static/ || exit
|
STATIC_DIR=$2
|
||||||
|
BACKEND_DIR=$3
|
||||||
|
|
||||||
npx turbo build \
|
pwd
|
||||||
&& cp -r ./dist/* $2
|
|
||||||
|
cp -r $SOURCE_DIR/apps/vdn-static/dist/* "$STATIC_DIR" || { echo "Can't copy static dist 😓 - code $?"; exit; }
|
||||||
|
cp -r $SOURCE_DIR/apps/vdb-backend/dist/* "$BACKEND_DIR" || { echo "Can't copy backend dist 😓 - code $?"; exit; }
|
||||||
|
|
|
||||||
12
stage.sh
Executable file
12
stage.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Deployment script to be run remotely on push to master at https://github.com/ViossaDiskordServer/ViossaDotNet/
|
||||||
|
# Stages static content in a folder immediately for testing. run ./deploy.sh to convert main site.
|
||||||
|
# Usage: sh ./stage.sh SOURCE_DIR
|
||||||
|
#
|
||||||
|
|
||||||
|
SOURCE_DIR=$1
|
||||||
|
|
||||||
|
cd "$1"|| { echo "Can't cd 😓"; exit; }
|
||||||
|
git fetch --all && git branch "backup-$(date +'%s')" && git reset --hard origin/main && npx turbo build
|
||||||
Loading…
Add table
Add a link
Reference in a new issue