Skip to content

Commit ed98774

Browse files
committed
Update .gitlab-ci.yml
1 parent 266c354 commit ed98774

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

.gitlab-ci.yml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,44 @@ build:
99
- current
1010
- rc
1111

12-
deploy-release:
12+
.deploy: &deploy
1313
tags:
1414
- esphomedocs
1515
before_script:
1616
- mkdir -p /root/.ssh
17-
- echo "$GITHUB_PRIVATE_KEY" | tr -d '\r' >/root/.ssh/id_rsa
17+
- echo "$PRIVATE_KEY" | tr -d '\r' >/root/.ssh/id_rsa
1818
- chmod 600 /root/.ssh/id_rsa
1919
- ssh-keyscan -t rsa github.com >>/root/.ssh/known_hosts
2020
- git config --global user.email "$GITHUB_EMAIL"
2121
- git config --global user.name "$GITHUB_NAME"
2222
- git worktree prune
23-
- rm -rf ../esphomelib
23+
- rm -rf ../esphomelib _build/html/
2424
script:
25-
- git fetch --force git@github.com:OttoWinter/esphomedocs.git gh-pages:gh-pages
25+
- mkdir -p _build/html
26+
- git fetch --force git@github.com:${TARGET_REPO}.git gh-pages:gh-pages
2627
- git worktree add _build/html gh-pages
2728
- make ../esphomelib
28-
- make deploy
29-
- git -C _build/html push git@github.com:OttoWinter/esphomedocs.git gh-pages
29+
- touch _build/html/.nojekyll
30+
- echo ${CNAME} >_build/html/CNAME
31+
- make html
32+
- git -C _build/html add --all
33+
- git -C _build/html commit -m "Deploy to gh-pages"
34+
- git -C _build/html push -f git@github.com:${TARGET_REPO}.git gh-pages
35+
36+
deploy-release:
37+
<<: *deploy
38+
variables:
39+
TARGET_REPO: OttoWinter/esphomedocs
40+
PRIVATE_KEY: ${GITHUB_PRIVATE_KEY}
41+
CNAME: esphomelib.com
3042
only:
3143
- current
3244

33-
3445
deploy-beta:
35-
tags:
36-
- esphomedocs
37-
before_script:
38-
- mkdir -p /root/.ssh
39-
- echo "$GITHUB_BETA_PRIVATE_KEY" | tr -d '\r' >/root/.ssh/id_rsa
40-
- chmod 600 /root/.ssh/id_rsa
41-
- ssh-keyscan -t rsa github.com >>/root/.ssh/known_hosts
42-
- git config --global user.email "$GITHUB_EMAIL"
43-
- git config --global user.name "$GITHUB_NAME"
44-
- git worktree prune
45-
- rm -rf ../esphomelib
46-
script:
47-
- git fetch --force git@github.com:OttoWinter/beta.esphomelib.com.git master:gh-pages
48-
- git worktree add _build/html gh-pages
49-
- make ../esphomelib
50-
- make deploy
51-
- git -C _build/html push git@github.com:OttoWinter/beta.esphomelib.com.git gh-pages
46+
<<: *deploy
47+
variables:
48+
TARGET_REPO: OttoWinter/esphomedocs-beta
49+
PRIVATE_KEY: ${GITHUB_BETA_PRIVATE_KEY}
50+
CNAME: beta.esphomelib.com
5251
only:
5352
- rc

0 commit comments

Comments
 (0)