Migrate to woodpecker #150

Merged
Vylpes merged 4 commits from feature/122-woodpecker-ci into develop 2024-01-26 21:02:17 +00:00
3 changed files with 35 additions and 37 deletions
Showing only changes of commit 4558b7b1cf - Show all commits

View file

@ -21,3 +21,27 @@ steps:
when:
event: push
branch: [ hotfix/*, feature/*, renovate/*, develop, main ]
stage:
image: alpine
secrets: [ ssh_key, stage_bot_token ]
commands:
- apk add rsync openssh-client
- eval `ssh-agent -s`
- echo "$SSH_KEY" | tr -d '\r' | ssh-add -
- rsync -e "ssh -o StrictHostKeyChecking=no" -r ./* vylpes@192.168.68.120:/home/vylpes/apps/card-drop/card-drop_stage
- ssh vylpes@192.168.68.120 BOT_TOKEN='$${stage_bot_token}' 'bash -s' < ./scripts/deploy_stage.sh
when:
event: push
branch: [ develop ]
deploy:
image: alpine
secrets: [ ssh_key, prod_bot_token ]
commands:
- apk add rsync openssh-client
- eval `ssh-agent -s`
- echo "$SSH_KEY" | tr -d '\r' | ssh-add -
- rsync -e "ssh -o StrictHostKeyChecking=no" -r ./* vylpes@192.168.68.120:/home/vylpes/apps/card-drop/card-drop_prod
- ssh vylpes@192.168.68.120 BOT_TOKEN='$${prod_bot_token}' 'bash -s' < ./scripts/deploy_prod.sh
when:
event: push
branch: [ main ]

View file

@ -3,21 +3,8 @@
export PATH="$HOME/.yarn/bin:$PATH"
export PATH="$HOME/.nodeuse/bin:$PATH"
export BOT_TOKEN=$(cat $HOME/scripts/card-drop/prod_key.txt)
cd ~/apps/card-drop/card-drop_prod \
&& git checkout main \
&& git fetch \
&& git pull \
&& docker compose --file docker-compose.prod.yml down \
&& (pm2 stop card-drop_prod || true) \
&& (pm2 delete card-drop_prod || true) \
&& cp .prod.env .env \
&& npm run clean \
&& npm ci \
&& npm run build \
&& docker compose --file docker-compose.prod.yml up -d \
&& echo "Sleeping for 10 seconds to let database load..." \
&& sleep 10 \
&& npm run db:up \
&& NODE_ENV=production pm2 start --name card-drop_prod dist/bot.js
cd ~/apps/card-drop/card-drop_prod
docker compose --file docker-compose.prod.yml up -d
sleep 10
cp .prod.env .env
pm2 restart card-drop_prod || pm2 start --name card-drop_prod dist/bot.js

View file

@ -3,21 +3,8 @@
export PATH="$HOME/.yarn/bin:$PATH"
export PATH="$HOME/.nodeuse/bin:$PATH"
export BOT_TOKEN=$(cat $HOME/scripts/card-drop/stage_key.txt)
cd ~/apps/card-drop/card-drop_stage \
&& git checkout develop \
&& git fetch \
&& git pull \
&& docker compose --file docker-compose.stage.yml down \
&& (pm2 stop card-drop_stage || true) \
&& (pm2 delete card-drop_stage || true) \
&& cp .stage.env .env \
&& npm run clean \
&& npm ci \
&& npm run build \
&& docker compose --file docker-compose.stage.yml up -d \
&& echo "Sleeping for 10 seconds to let database load..." \
&& sleep 10 \
&& npm run db:up \
&& NODE_ENV=production pm2 start --name card-drop_stage dist/bot.js
cd ~/apps/card-drop/card-drop_stage
docker compose --file docker-compose.stage.yml up -d
sleep 10
cp .stage.env .env
pm2 restart card-drop_stage || pm2 start --name card-drop_stage dist/bot.js