New gitlab-ci, test once back up
This commit is contained in:
parent
658ac61d3b
commit
1bdbcb25cd
3 changed files with 552 additions and 347 deletions
|
@ -1,11 +1,31 @@
|
|||
stages:
|
||||
- build
|
||||
- deploy
|
||||
- notification
|
||||
|
||||
build-site:
|
||||
image: node:lts
|
||||
stage: build
|
||||
cache:
|
||||
paths:
|
||||
- node_modules/
|
||||
only:
|
||||
- main
|
||||
script:
|
||||
- npm install
|
||||
- npm run build
|
||||
- rm -r public/assets/data/
|
||||
- cp serve.json public
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
expire_in: 1 day
|
||||
|
||||
deploy-site:
|
||||
image: node:lts
|
||||
stage: deploy
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
only:
|
||||
- main
|
||||
before_script:
|
||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
- eval $(ssh-agent -s)
|
||||
|
@ -16,13 +36,21 @@ deploy-site:
|
|||
- chmod 644 ~/.ssh/known_hosts
|
||||
|
||||
script:
|
||||
- echo "Connecting to proxmox machine"
|
||||
- ssh $DEPLOY_USER@$DEPLOY_HOST -o StrictHostKeyChecking=no IdentitiesOnly=yes "screen -X -S website-firq-npx kill; rm -r -f public/*; cd build; git reset --hard; git pull; rm -r -f node_modules; npm install; npm run build; rm -r public/assets/data/; cp -R public ~; cp serve.json ~/public; cd ~; screen -S website-firq-npx -dm npx serve public/ -p 9000 -c serve.json"
|
||||
- echo "Getting artifacts"
|
||||
- ls public
|
||||
- echo "Stopping screen session and cleaning"
|
||||
- ssh $DEPLOY_USER@$DEPLOY_HOST -o StrictHostKeyChecking=no IdentitiesOnly=yes "screen -X -S website-firq-npx kill; rm -r -f public/*;"
|
||||
- echo "Copying to proxmox machine"
|
||||
- rsync -e "ssh -o StrictHostKeyChecking=no IdentitiesOnly=yes" -a --progress public/ $DEPLOY_USER@$DEPLOY_HOST:~/public
|
||||
- echo "Restarting screen session"
|
||||
- ssh $DEPLOY_USER@$DEPLOY_HOST -o StrictHostKeyChecking=no IdentitiesOnly=yes "screen -S website-firq-npx -dm npx serve public/ -p 9000 -c serve.json"
|
||||
- echo "Website is up on https://firq.dev/"
|
||||
|
||||
success_notification:
|
||||
stage: notification
|
||||
before_script:
|
||||
- apk update
|
||||
- apk add rsync
|
||||
- apk add curl
|
||||
- apk add git
|
||||
- apk add bash
|
||||
|
|
861
package-lock.json
generated
861
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@astrojs/sitemap": "^1.2.1",
|
||||
"astro": "^2.0.2",
|
||||
"astro": "^2.1.3",
|
||||
"iconoir": "^6.1.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue