2024-10-14 16:59:44 +00:00
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
docker:
|
2024-10-14 17:36:18 +00:00
|
|
|
- image: cimg/node:22.9
|
2024-10-14 16:59:44 +00:00
|
|
|
resource_class: medium
|
|
|
|
steps:
|
|
|
|
- add_ssh_keys:
|
|
|
|
fingerprints:
|
|
|
|
- "86:3b:c9:a6:d1:b9:a8:dc:0e:00:db:99:8d:19:c4:3e"
|
2024-10-14 17:06:45 +00:00
|
|
|
- run:
|
|
|
|
name: Add known hosts
|
|
|
|
command: |
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
echo $GH_HOST >> ~/.ssh/known_hosts
|
2024-10-14 18:47:20 +00:00
|
|
|
echo $RPM_HOST >> ~/.ssh/known_hosts
|
2024-10-14 16:59:44 +00:00
|
|
|
- run:
|
|
|
|
name: Install NPM
|
|
|
|
command: |
|
2024-10-14 19:41:52 +00:00
|
|
|
sudo apt-get update && sudo apt-get install -y rsync npm
|
2024-10-14 16:59:44 +00:00
|
|
|
- run:
|
|
|
|
name: Clone WebVM
|
|
|
|
command: |
|
|
|
|
git clone --branch $CIRCLE_BRANCH --single-branch git@github.com:leaningtech/webvm.git
|
|
|
|
- run:
|
2024-10-14 19:38:12 +00:00
|
|
|
name: Build WebVM
|
2024-10-14 16:59:44 +00:00
|
|
|
command: |
|
|
|
|
cd webvm/
|
2024-10-14 17:10:03 +00:00
|
|
|
npm install
|
2024-10-14 16:59:44 +00:00
|
|
|
npm run build
|
|
|
|
- run:
|
|
|
|
name: Deploy webvm
|
|
|
|
command: |
|
2024-10-14 19:38:12 +00:00
|
|
|
rsync -avz -e "ssh -p ${SSH_PORT}" webvm/build/ leaningtech@${SSH_HOST}:/srv/web/webvm_next/
|
2024-10-14 16:59:44 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
deploy:
|
|
|
|
when:
|
|
|
|
equal: [ << pipeline.trigger_source >>, "api" ]
|
|
|
|
jobs:
|
|
|
|
- deploy
|