mirror of
https://github.com/huhu/rust-search-extension
synced 2024-11-14 23:57:07 +00:00
38 lines
No EOL
851 B
Bash
Executable file
38 lines
No EOL
851 B
Bash
Executable file
#!/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 |