Migrate to woodpecker #150
3 changed files with 57 additions and 36 deletions
47
.woodpecker.yml
Normal file
47
.woodpecker.yml
Normal file
|
@ -0,0 +1,47 @@
|
|||
steps:
|
||||
build:
|
||||
image: node
|
||||
commands:
|
||||
- npm ci
|
||||
- npm run build
|
||||
when:
|
||||
event: push
|
||||
branch: [ hotfix/*, feature/*, renovate/*, develop, main ]
|
||||
lint:
|
||||
image: node
|
||||
commands:
|
||||
- npm run lint
|
||||
when:
|
||||
event: push
|
||||
branch: [ hotfix/*, feature/*, renovate/*, develop, main ]
|
||||
test:
|
||||
image: node
|
||||
commands:
|
||||
- npm test
|
||||
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 ]
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in a new issue