esphome-docs/.gitlab-ci.yml
2018-11-14 22:12:27 +01:00

55 lines
1.4 KiB
YAML

---
build:
tags:
- esphomedocs
script:
- make ../esphomelib
- make html
except:
- current
- rc
.deploy: &deploy
tags:
- esphomedocs
before_script:
- mkdir -p /root/.ssh
- echo "$PRIVATE_KEY" | tr -d '\r' >/root/.ssh/id_rsa
- chmod 600 /root/.ssh/id_rsa
- ssh-keyscan -t rsa github.com >>/root/.ssh/known_hosts
- git config --global user.email "$GITHUB_EMAIL"
- git config --global user.name "$GITHUB_NAME"
- git worktree prune
- rm -rf ../esphomelib _build/html/
script:
- mkdir -p _build/html
- git fetch --force git@github.com:${TARGET_REPO}.git gh-pages:gh-pages
- git worktree add _build/html gh-pages
- make ../esphomelib
- touch _build/html/.nojekyll
- echo ${CNAME} >_build/html/CNAME
- make html
- git -C _build/html add --all
- git -C _build/html commit -m "Deploy to gh-pages"
- git -C _build/html push -f git@github.com:${TARGET_REPO}.git gh-pages
deploy-release:
<<: *deploy
variables:
TARGET_REPO: OttoWinter/esphomedocs
PRIVATE_KEY: ${GITHUB_PRIVATE_KEY}
CNAME: esphomelib.com
BASE_URL: https://esphomelib.com
only:
- current
deploy-beta:
<<: *deploy
variables:
TARGET_REPO: OttoWinter/esphomedocs-beta
PRIVATE_KEY: ${GITHUB_BETA_PRIVATE_KEY}
CNAME: beta.esphomelib.com
BASE_URL: https://beta.esphomelib.com
only:
- rc