refactor(ci): tweaks
- remove `--del` option from rsync commands - switch to bun (again) - fix `hasMigrated = true` not being transpiled
This commit is contained in:
		
							parent
							
								
									6faa88d83f
								
							
						
					
					
						commit
						4ae045819f
					
				@ -8,13 +8,13 @@ stages:
 | 
				
			|||||||
build_stage:
 | 
					build_stage:
 | 
				
			||||||
  stage: build
 | 
					  stage: build
 | 
				
			||||||
  # use node docker image as enviroment
 | 
					  # use node docker image as enviroment
 | 
				
			||||||
  image: node:latest
 | 
					  image: oven/bun:canary-debian
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    # install & build the NuxtJS application
 | 
					    # install & build the NuxtJS application
 | 
				
			||||||
    - apt update
 | 
					 | 
				
			||||||
    #- apt-get install -y --no-install-recommends python3 build-essential
 | 
					    #- apt-get install -y --no-install-recommends python3 build-essential
 | 
				
			||||||
    - npm install
 | 
					    - bun install
 | 
				
			||||||
    - npm run build
 | 
					    - 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
 | 
					  # define artifacts which are shared between stages
 | 
				
			||||||
  artifacts:
 | 
					  artifacts:
 | 
				
			||||||
    paths:
 | 
					    paths:
 | 
				
			||||||
@ -34,12 +34,12 @@ deploy_staging:
 | 
				
			|||||||
  before_script:
 | 
					  before_script:
 | 
				
			||||||
    - ". ${CI_PROJECT_DIR}/.more-ci/deploy-pre.sh ${SSH_DEPLOY_KEY}"
 | 
					    - ". ${CI_PROJECT_DIR}/.more-ci/deploy-pre.sh ${SSH_DEPLOY_KEY}"
 | 
				
			||||||
  script:
 | 
					  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
 | 
					    - scp ${ENV_FILE} rockfic@${DEPLOY_SERVER}:rockfic-staging/.env
 | 
				
			||||||
    - sshpass -p "${OLDROOTPWD}" ssh root@rockfic.com '~/cp.sh'
 | 
					    - sshpass -p "${OLDROOTPWD}" ssh root@rockfic.com '~/cp.sh'
 | 
				
			||||||
    - ssh rockfic@${DEPLOY_SERVER} "~/stage.sh" ${DB_NAME}
 | 
					    - ssh rockfic@${DEPLOY_SERVER} "~/stage.sh" ${DB_NAME}
 | 
				
			||||||
    # restart Node.js and reload nginx configuration
 | 
					    # 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
 | 
					    - ssh rockfic@${DEPLOY_SERVER} sudo systemctl reload apache2
 | 
				
			||||||
  except:
 | 
					  except:
 | 
				
			||||||
    - tags
 | 
					    - tags
 | 
				
			||||||
@ -55,10 +55,9 @@ deploy_production:
 | 
				
			|||||||
  before_script:
 | 
					  before_script:
 | 
				
			||||||
    - ". ${CI_PROJECT_DIR}/.more-ci/deploy-pre.sh ${SSH_DEPLOY_KEY}"
 | 
					    - ". ${CI_PROJECT_DIR}/.more-ci/deploy-pre.sh ${SSH_DEPLOY_KEY}"
 | 
				
			||||||
  script:
 | 
					  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
 | 
					    - scp ${ENV_FILE} root@${DEPLOY_SERVER}:/home/@rockfic/.env
 | 
				
			||||||
    - sed -Ei "s,(hasMigrated = )false,\1true," /home/@rockfic/lib/dbconfig.ts
 | 
					    - ssh root@${DEPLOY_SERVER} 'nohup bun "/home/@rockfic/.output/server/index.mjs" & disown %1'
 | 
				
			||||||
    - ssh root@${DEPLOY_SERVER} 'node "/home/@rockfic/.output/server/index.mjs" &>/dev/null & disown %1'
 | 
					 | 
				
			||||||
    - ssh root@${DEPLOY_SERVER} sudo systemctl reload apache2
 | 
					    - ssh root@${DEPLOY_SERVER} sudo systemctl reload apache2
 | 
				
			||||||
  only:
 | 
					  only:
 | 
				
			||||||
    - tags
 | 
					    - tags
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user