2023-06-13 11:17:02 +02:00
|
|
|
steps:
|
|
|
|
build:
|
|
|
|
image: node:19
|
|
|
|
when:
|
|
|
|
- event: push
|
2023-06-13 11:23:46 +02:00
|
|
|
branch: [main, staging]
|
2023-06-13 11:17:02 +02:00
|
|
|
commands:
|
|
|
|
- npm install -D @11ty/eleventy
|
2023-06-13 11:44:25 +02:00
|
|
|
- rm -rf public/
|
2023-06-13 11:17:02 +02:00
|
|
|
- npx @11ty/eleventy --input=. --output=public
|
|
|
|
|
2023-06-14 11:32:30 +02:00
|
|
|
deploy-staging:
|
2023-06-13 11:17:02 +02:00
|
|
|
image: alpine:latest
|
|
|
|
when:
|
|
|
|
- event: push
|
2023-06-13 11:23:46 +02:00
|
|
|
branch: staging
|
2023-06-13 11:17:02 +02:00
|
|
|
secrets:
|
|
|
|
- SSH_KEY
|
|
|
|
environment:
|
|
|
|
- TARGET_SERVER=cloud.lauka.net
|
|
|
|
- TARGET_USER=webadmin
|
2023-06-14 11:32:30 +02:00
|
|
|
- TARGET_PATH=/webroot/staging-www.lauka.net
|
2023-06-13 11:17:02 +02:00
|
|
|
commands:
|
|
|
|
- apk add --update --no-cache openssh rsync git
|
|
|
|
- mkdir -p $HOME/.ssh
|
|
|
|
- echo "$SSH_KEY" > $HOME/.ssh/id_ed25519
|
|
|
|
- chmod 0600 $HOME/.ssh/id_ed25519
|
|
|
|
- ssh-keyscan -t ed25519 $TARGET_SERVER >> $HOME/.ssh/known_hosts
|
|
|
|
- cd public/
|
2023-06-14 11:32:30 +02:00
|
|
|
- rsync -avh --delete ./ $TARGET_USER@$TARGET_SERVER:$TARGET_PATH
|
2023-06-13 11:17:02 +02:00
|
|
|
|
|
|
|
|
2023-06-14 11:32:30 +02:00
|
|
|
deploy-production:
|
2023-06-13 11:17:02 +02:00
|
|
|
image: alpine:latest
|
|
|
|
when:
|
|
|
|
- event: push
|
2023-06-13 11:23:46 +02:00
|
|
|
branch: main
|
2023-06-13 11:17:02 +02:00
|
|
|
secrets:
|
|
|
|
- SSH_KEY
|
|
|
|
environment:
|
|
|
|
- TARGET_SERVER=cloud.lauka.net
|
|
|
|
- TARGET_USER=webadmin
|
2023-06-14 11:32:30 +02:00
|
|
|
- TARGET_PATH=/webroot/www.lauka.net
|
2023-06-13 11:17:02 +02:00
|
|
|
commands:
|
|
|
|
- apk add --update --no-cache openssh rsync git
|
|
|
|
- mkdir -p $HOME/.ssh
|
|
|
|
- echo "$SSH_KEY" > $HOME/.ssh/id_ed25519
|
|
|
|
- chmod 0600 $HOME/.ssh/id_ed25519
|
|
|
|
- ssh-keyscan -t ed25519 $TARGET_SERVER >> $HOME/.ssh/known_hosts
|
|
|
|
- cd public/
|
2023-06-14 11:32:30 +02:00
|
|
|
- rsync -avh --delete ./ $TARGET_USER@$TARGET_SERVER:$TARGET_PATH
|