From 4ae045819f85082cb0e358fd23d4340592f4bb14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Sat, 30 Dec 2023 16:57:56 -0500 Subject: [PATCH] refactor(ci): tweaks - remove `--del` option from rsync commands - switch to bun (again) - fix `hasMigrated = true` not being transpiled --- .gitlab-ci.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98464a3..b8454ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,13 +8,13 @@ stages: build_stage: stage: build # use node docker image as enviroment - image: node:latest + image: oven/bun:canary-debian script: # install & build the NuxtJS application - - apt update #- apt-get install -y --no-install-recommends python3 build-essential - - npm install - - npm run build + - bun install + - sed -Ei "s,(hasMigrated = )false,\1true," ${CI_PROJECT_DIR}/lib/dbconfig.ts + - NODE_ENV=production bun run --bun build # define artifacts which are shared between stages artifacts: paths: @@ -34,12 +34,12 @@ deploy_staging: before_script: - ". ${CI_PROJECT_DIR}/.more-ci/deploy-pre.sh ${SSH_DEPLOY_KEY}" script: - - rsync --archive --del ${CI_PROJECT_DIR}/ rockfic@${DEPLOY_SERVER}:~/rockfic-staging/ + - rsync --archive ${CI_PROJECT_DIR}/ rockfic@${DEPLOY_SERVER}:~/rockfic-staging/ - scp ${ENV_FILE} rockfic@${DEPLOY_SERVER}:rockfic-staging/.env - sshpass -p "${OLDROOTPWD}" ssh root@rockfic.com '~/cp.sh' - ssh rockfic@${DEPLOY_SERVER} "~/stage.sh" ${DB_NAME} # restart Node.js and reload nginx configuration - - ssh rockfic@${DEPLOY_SERVER} 'node "~/rockfic-staging/.output/server/index.mjs" &>/dev/null & disown %1' + - ssh rockfic@${DEPLOY_SERVER} 'NODE_ENV=production nohup bun run --bun "~/rockfic-staging/.output/server/index.mjs" & disown %1' - ssh rockfic@${DEPLOY_SERVER} sudo systemctl reload apache2 except: - tags @@ -55,10 +55,9 @@ deploy_production: before_script: - ". ${CI_PROJECT_DIR}/.more-ci/deploy-pre.sh ${SSH_DEPLOY_KEY}" script: - - rsync --archive --del ${CI_PROJECT_DIR}/ root@${DEPLOY_SERVER}:/home/@rockfic/ + - rsync --archive ${CI_PROJECT_DIR}/ root@${DEPLOY_SERVER}:/home/@rockfic/ - scp ${ENV_FILE} root@${DEPLOY_SERVER}:/home/@rockfic/.env - - sed -Ei "s,(hasMigrated = )false,\1true," /home/@rockfic/lib/dbconfig.ts - - ssh root@${DEPLOY_SERVER} 'node "/home/@rockfic/.output/server/index.mjs" &>/dev/null & disown %1' + - ssh root@${DEPLOY_SERVER} 'nohup bun "/home/@rockfic/.output/server/index.mjs" & disown %1' - ssh root@${DEPLOY_SERVER} sudo systemctl reload apache2 only: - tags