forked from qiskit-community/qiskit-textbook
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b735aa
commit 032fdb0
Showing
2 changed files
with
9 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,24 @@ | ||
#!/bin/bash | ||
|
||
user=delapuente | ||
org=qiskit | ||
repo=qiskit.org | ||
path=textbook | ||
|
||
if [[ $TRAVIS_BRANCH != "stable" ]] && [[ $TRAVIS_BRANCH != "" ]] | ||
then | ||
path="${path}-${TRAVIS_BRANCH}" | ||
fi | ||
|
||
download_repo () { | ||
root=$1 | ||
mkdir -p $root | ||
pushd $root || return | ||
git clone --depth 1 "https://${user}:${GITHUB_TOKEN}@github.com/${org}/${repo}.git" | ||
popd || return | ||
} | ||
|
||
push_repo () { | ||
root=$1 | ||
pushd $root/$repo || return | ||
git add static/${path} | ||
git add . | ||
git commit -m"Updating ${path} to ${TRAVIS_REPO_SLUG}@${TRAVIS_COMMIT}" | ||
git push origin master | ||
popd || return | ||
install_rclone () { | ||
curl https://downloads.rclone.org/rclone-current-linux-amd64.deb -o rclone.deb | ||
sudo apt-get install -y ./rclone.deb | ||
CONFIG_PATH=$(rclone config file | tail -1) | ||
echo "Decrypting config into ${CONFIG_PATH}" | ||
openssl aes-256-cbc -K $encrypted_rclone_key -iv $encrypted_rclone_iv -in rclone.conf.enc -out $CONFIG_PATH -d | ||
} | ||
|
||
main () { | ||
echo "Deploy in ${path}" | ||
download_repo _repo | ||
mkdir -p _repo/$repo/static/${path} | ||
rsync -r --delete _site/ _repo/$repo/static/${path} | ||
push_repo _repo | ||
echo "Updating ${path} to ${TRAVIS_REPO_SLUG}@${TRAVIS_COMMIT}" | ||
install_rclone | ||
rclone sync _site/ IBMCOS:qiskit-org-website/${path} | ||
} | ||
|
||
main |
Binary file not shown.