firq-dev-website/.gitlab-ci.yml

46 lines
1.4 KiB
YAML
Raw Normal View History

stages:
2023-03-11 00:15:01 +00:00
- deploy
- notification
deploy-site:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == "main"
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- 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; cp -R public ~; cd ~; screen -S website-firq-npx -dm npx serve public/ -p 9000"
success_notification:
stage: notification
2023-03-11 00:04:56 +00:00
before_script:
2023-03-11 00:10:19 +00:00
- apk update
- apk add curl
- apk add git
script:
- wget https://raw.githubusercontent.com/DiscordHooks/gitlab-ci-discord-webhook/master/send.sh
- chmod +x send.sh
2023-03-11 00:20:30 +00:00
- file ./send.sh
- dos2unix ./send.sh
- ./send.sh success $WEBHOOK_URL
when: on_success
failure_notification:
stage: notification
2023-03-11 00:04:56 +00:00
before_script:
2023-03-11 00:10:19 +00:00
- apk update
- apk add curl
- apk add git
script:
- wget https://raw.githubusercontent.com/DiscordHooks/gitlab-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh failure $WEBHOOK_URL
when: on_failure