rust-search-extension/depoly-crates-index

38 lines
851 B
Text
Raw Normal View History

2019-12-22 16:23:11 +00:00
#!/usr/bin/env bash
set -e
# Add binary and script file to bin directory for crates-index build
CRATES_INDEX_PATH="/tmp/crates-index.js"
BRANCH="gh-pages"
build() {
# rustup target add x86_64-unknown-linux-gnu
# cargo build --release --target x86_64-unknown-linux-gnu
echo "Starting building crates-index..."
cd rust
cargo run $CRATES_INDEX_PATH
cd ..
echo "{\"version\": $(date +%s)}" > /tmp/version.json
}
upload() {
echo "Starting uploading crates-index..."
git checkout $BRANCH
if [ ! -d "crates" ]
then
mkdir crates
fi
cp "${CRATES_INDEX_PATH}" /tmp/version.json crates/
git config user.name "GitHub Actions"
git config user.email "github-actions-bot@users.noreply.github.com"
git add crates/
git commit -m "Upload latest crates index"
git push origin $BRANCH
echo "Upload complete"
}
build
upload