fix: deployment scripts and index.ts problems

This commit is contained in:
nikomiko 2026-02-05 13:46:51 -05:00 committed by Sheldon Cooper
parent 2fd544c0a7
commit e950e7ea8e
4 changed files with 54 additions and 17 deletions

View file

@ -1,4 +1,4 @@
name: SSH Deploy
name: SSH Deploy Staged
on:
push:
@ -20,4 +20,4 @@ jobs:
- name: SSH and run deployment script
run: |
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'

View file

@ -107,7 +107,7 @@ async function loadSheet() {
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]);
console.log(keys);
@ -117,25 +117,44 @@ async function loadSheet() {
return;
}
if (!lects) {
if (!lect_names) {
console.error("No lects found");
return;
}
for (const lect of lects) {
const lects = Array<Lect>();
for (const lect of lect_names) {
let l = new Lect();
l.name = lect;
l.save();
lects.push(l)
console.log(l);
}
const nikolect = lects.indexOf("Nikomiko");
const lemmas = Array<Lemma>();
for (let i = 0; i < rows.length; i++) {
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();
if (lemma_key == null || lemma_key.length == 0) {
@ -151,12 +170,15 @@ async function loadSheet() {
lemmas.push(lemma);
lemma.word_forms = Array<WordForm>();
for (let i = 0; i < row.length; i++) {
const cell = row?.[i];
for (let j = 0; j < row.length; j++) {
const cell = row?.[j];
const lect = lects[j];
if (
cell === null ||
cell === undefined ||
(typeof cell === "string" && cell.length === 0)
(typeof cell === "string" && cell.length === 0) ||
!lect
) {
continue;
}
@ -164,7 +186,7 @@ async function loadSheet() {
for (let word_form of cell.split(";")) {
const f = new WordForm();
f.word_form = word_form;
f.lect = lects[i];
f.lect = lect;
lemma.word_forms.push(f);
}
}

View file

@ -3,11 +3,14 @@
#
# 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
cd $1/apps/vdn-static/ || exit
SOURCE_DIR=$1
STATIC_DIR=$2
BACKEND_DIR=$3
npx turbo build \
&& cp -r ./dist/* $2
pwd
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
View 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