Skip to content

ci: deploy package index to esp8266.github.io #6062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions package/deploy_package_index.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# This script updates package index hosted on arduino.esp8266.com.
# This script updates package index hosted on esp8266.github.io (aka arduino.esp8266.com).
# Normally is run by Travis CI for tagged versions, as a deploy step.

tag=`git describe --tags`
Expand All @@ -10,26 +10,23 @@ cd $(dirname "$0")
# Decrypt and install SSH private key.
# "encrypted_xxx_key" and "encrypted_xxx_iv" are environment variables
# known to Travis CI builds.
openssl aes-256-cbc -K $encrypted_3f14690ceb9b_key -iv $encrypted_3f14690ceb9b_iv -in arduino-esp8266-travis.enc -out arduino-esp8266-travis -d
openssl aes-256-cbc -K $encrypted_3a94a4db7dec_key -iv $encrypted_3a94a4db7dec_iv -in esp8266_github_io_deploy.enc -out esp8266_github_io_deploy -d
eval "$(ssh-agent -s)"
chmod 600 arduino-esp8266-travis
ssh-add arduino-esp8266-travis

# Set SSH server public key
echo "arduino.esp8266.com,104.131.82.128 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAvoxsdf1jJ1XX7RrCtAQyjvZ3b33bWYfB/XDvEMLtxnJhZr+P/wa7yuZ+UJJ1wuJc+wcIMBNZ2Zz/MbdRMey7A=" \
>> $HOME/.ssh/known_hosts

branch=stable
[email protected]
base_dir=apps/download_files/download

# Upload package_esp8266com_index.json
ssh $ssh_dl_server "mkdir -p $base_dir/versions/$tag"
scp versions/$tag/package_esp8266com_index.json $ssh_dl_server:$base_dir/versions/$tag/

# Change symlink for stable version
oldver=$(ssh $ssh_dl_server "readlink $base_dir/$branch")
newver="versions/$tag"
echo "Changing version of $branch from $oldver to $newver"

ssh $ssh_dl_server "pushd apps/download_files/download && ln -snf versions/$tag $branch"
chmod 600 esp8266_github_io_deploy
ssh-add esp8266_github_io_deploy
echo -e "Host github.com\nStrictHostKeyChecking no\n" >> ~/.ssh/config

# Clone the Github pages repository
git clone [email protected]:esp8266/esp8266.github.io.git
pushd esp8266.github.io

# Update the package index
cp ../versions/$tag/package_esp8266com_index.json stable/package_esp8266com_index.json
git add stable/package_esp8266com_index.json

# Commit and push the changes
git config user.email "[email protected]"
git config user.name "Travis CI"
git commit -m "update package index for release $tag"
git push origin master
popd
Binary file added package/esp8266_github_io_deploy.enc
Binary file not shown.