From c833b13883c1a945b815a669e219cb4a97e88bc7 Mon Sep 17 00:00:00 2001 From: lauralani Date: Tue, 13 Jun 2023 11:17:02 +0200 Subject: [PATCH] update CI --- .woodpecker.yml | 26 --------------------- .woodpecker/deploy.yaml | 52 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 26 deletions(-) delete mode 100644 .woodpecker.yml create mode 100644 .woodpecker/deploy.yaml diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index a557b07..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,26 +0,0 @@ -when: - event: push - branch: main -pipeline: - build: - image: node:19 - commands: - - npm install -D @11ty/eleventy - - npx @11ty/eleventy --input=. --output=public - - deploy: - image: alpine:latest - secrets: - - SSH_KEY - environment: - - TARGET_SERVER=cloud.lauka.net - - TARGET_USER=webadmin - - TARGET_PATH=/webroot/www.lauka.net - 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/ - - rsync -avh --delete ./ $TARGET_USER@$TARGET_SERVER:$TARGET_PATH diff --git a/.woodpecker/deploy.yaml b/.woodpecker/deploy.yaml new file mode 100644 index 0000000..685ef7d --- /dev/null +++ b/.woodpecker/deploy.yaml @@ -0,0 +1,52 @@ +steps: + build: + image: node:19 + when: + - event: push + - branch: + - main + - staging + commands: + - npm install -D @11ty/eleventy + - npx @11ty/eleventy --input=. --output=public + + deploy-stage: + image: alpine:latest + when: + - event: push + - branch: staging + secrets: + - SSH_KEY + environment: + - TARGET_SERVER=cloud.lauka.net + - TARGET_USER=webadmin + - TARGET_PATH=/webroot/www.lauka.net + 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/ + - rsync -avh --delete ./ $TARGET_USER@$TARGET_SERVER:$TARGET_PATH + + + deploy-prod: + image: alpine:latest + when: + - event: push + - branch: main + secrets: + - SSH_KEY + environment: + - TARGET_SERVER=cloud.lauka.net + - TARGET_USER=webadmin + - TARGET_PATH=/webroot/staging-www.lauka.net + 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/ + - rsync -avh --delete ./ $TARGET_USER@$TARGET_SERVER:$TARGET_PATH