1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00
esp8266/package/deploy_package_index.sh
Earle F. Philhower, III 3bd24587e1
Transition from TravisCI to GitHub CI (#7444)
Convert the continuous integration process to use GitHub's internal
CI cloud.  Allows us to run up to 20 jobs in parallel, speeding up
CI immensely.  Keep a short Travis-CI run, too, just for sanity and backup.

Uses new keys and secret when publishing a release to
esp8266.github.io.
2020-07-14 22:02:47 -07:00

37 lines
1.1 KiB
Bash

#!/bin/bash
# This script updates package index hosted on esp8266.github.io (aka arduino.esp8266.com).
tag=$(jq -r '.release.tag_name' "$GITHUB_EVENT_PATH")
if [ "$tag" == "" ]; then
tag=`git describe --tags`
fi
cd $(dirname "$0")
set -e # Abort with error if anything here does not go as expected!
# Install SSH private key from a GH Secret
echo $GHCI_DEPLOY_KEY | base64 -d > esp8266_github_io_deploy
eval "$(ssh-agent -s)"
chmod 600 esp8266_github_io_deploy
ssh-add esp8266_github_io_deploy
mkdir -p ~/.ssh
chmod go-w ~/.ssh
echo -e "Host github.com\nStrictHostKeyChecking no\n" >> ~/.ssh/config
chmod go-w ~/.ssh/config
# Clone the Github pages repository
git clone git@github.com:esp8266/esp8266.github.io.git
pushd esp8266.github.io
# Update the package index
cp ../versions/*/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 "github-ci-action@github.com"
git config user.name "GitHub CI Action"
git commit -m "Update package index for release $tag"
git push origin master
popd