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