11#! /bin/bash
22#
3- # This script updates package index hosted on arduino.esp8266.com.
3+ # This script updates package index hosted on esp8266.github.io (aka arduino.esp8266.com) .
44# Normally is run by Travis CI for tagged versions, as a deploy step.
55
66tag=` git describe --tags`
@@ -10,26 +10,23 @@ cd $(dirname "$0")
1010# Decrypt and install SSH private key.
1111# "encrypted_xxx_key" and "encrypted_xxx_iv" are environment variables
1212# known to Travis CI builds.
13- openssl aes-256-cbc -K $encrypted_3f14690ceb9b_key -iv $encrypted_3f14690ceb9b_iv -in arduino-esp8266-travis .enc -out arduino-esp8266-travis -d
13+ openssl aes-256-cbc -K $encrypted_3a94a4db7dec_key -iv $encrypted_3a94a4db7dec_iv -in esp8266_github_io_deploy .enc -out esp8266_github_io_deploy -d
1414eval " $( ssh-agent -s) "
15- chmod 600 arduino-esp8266-travis
16- ssh-add arduino-esp8266-travis
17-
18- # Set SSH server public key
19- echo " arduino.esp8266.com,104.131.82.128 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAvoxsdf1jJ1XX7RrCtAQyjvZ3b33bWYfB/XDvEMLtxnJhZr+P/wa7yuZ+UJJ1wuJc+wcIMBNZ2Zz/MbdRMey7A=" \
20- >> $HOME /.ssh/known_hosts
21-
22- branch=stable
23- ssh_dl_server=nodeuser@arduino.esp8266.com
24- base_dir=apps/download_files/download
25-
26- # Upload package_esp8266com_index.json
27- ssh $ssh_dl_server " mkdir -p $base_dir /versions/$tag "
28- scp versions/$tag /package_esp8266com_index.json $ssh_dl_server :$base_dir /versions/$tag /
29-
30- # Change symlink for stable version
31- oldver=$( ssh $ssh_dl_server " readlink $base_dir /$branch " )
32- newver=" versions/$tag "
33- echo " Changing version of $branch from $oldver to $newver "
34-
35- ssh $ssh_dl_server " pushd apps/download_files/download && ln -snf versions/$tag $branch "
15+ chmod 600 esp8266_github_io_deploy
16+ ssh-add esp8266_github_io_deploy
17+ echo -e " Host github.com\nStrictHostKeyChecking no\n" >> ~ /.ssh/config
18+
19+ # Clone the Github pages repository
20+ git clone git@github.com:esp8266/esp8266.github.io.git
21+ pushd esp8266.github.io
22+
23+ # Update the package index
24+ cp ../versions/$tag /package_esp8266com_index.json stable/package_esp8266com_index.json
25+ git add stable/package_esp8266com_index.json
26+
27+ # Commit and push the changes
28+ git config user.email " travis@travis-ci.org"
29+ git config user.name " Travis CI"
30+ git commit -m " update package index for release $tag "
31+ git push origin master
32+ popd
0 commit comments