| #!/bin/bash |
| |
| |
| set -e |
|
|
| DEPLOY_BRANCH=artifacts |
|
|
| |
| if test -n "$(git status --porcelain)"; then |
| echo "Please commit all changes before running this script." |
| exit 1 |
| fi |
| |
| if [[ $(git branch --show-current) != "main" ]]; then |
| echo "Please run this script on the main branch." |
| exit 1 |
| fi |
|
|
| |
| if [ -z "$1" ]; then |
| echo "Please provide the version component to bump (major, minor, patch)." |
| exit 2 |
| fi |
| if [ "$1" != "major" ] && [ "$1" != "minor" ] && [ "$1" != "patch" ]; then |
| echo "Invalid version component. Use major, minor, or patch." |
| exit 2 |
| fi |
| C=$1 |
| OLD_VERSION=`bump-my-version show current_version` |
| NEW_VERSION=`bump-my-version show new_version --increment $C` |
| |
| echo -n "Bumping version $C, $OLD_VERSION → $NEW_VERSION. Are you sure? (y/N) " |
| read -r answer |
| if [[ ! $answer =~ ^[Yy]$ ]]; then |
| echo "Aborting." |
| exit 3 |
| fi |
|
|
| |
| git fetch origin $DEPLOY_BRANCH:$DEPLOY_BRANCH |
| |
| |
| echo -n "Create artifacts tarballs. Are you sure? (y/N) " |
| read -r answer |
| if [[ ! $answer =~ ^[Yy]$ ]]; then |
| echo "Aborting." |
| exit 4 |
| fi |
| |
| ./make_artifacts.jl |
| mv Artifacts.toml artifacts/ |
|
|
| |
| |
| bump-my-version bump $C |
|
|
| |
| echo -n "Upload artifacts to huggingface. Are you sure? (y/N) " |
| read -r answer |
| if [[ ! $answer =~ ^[Yy]$ ]]; then |
| echo "Aborting." |
| exit 5 |
| fi |
| ARTIFACTS_DIR=artifacts |
| COMMIT_MSG="Update artifacts v$OLD_VERSION → v$NEW_VERSION" |
| |
| COMMIT_DESC=`find "$ARTIFACTS_DIR" -type f -exec basename {} \;` |
| hf upload \ |
| atomology/WannierDatasets $ARTIFACTS_DIR . \ |
| --repo-type dataset \ |
| --revision $DEPLOY_BRANCH \ |
| --include "*" \ |
| --commit-message "$COMMIT_MSG" \ |
| --commit-description "$COMMIT_DESC" |
| |
| git push origin main |
| git push origin --tags |
| |
| git fetch origin $DEPLOY_BRANCH:$DEPLOY_BRANCH |
|
|
| |
| echo -e "\n\n\n" |
| echo "Upload complete. Checking results at" |
| echo "https://huggingface.co/datasets/atomology/WannierDatasets/tree/$DEPLOY_BRANCH" |
| echo "https://huggingface.co/datasets/atomology/WannierDatasets/blob/$DEPLOY_BRANCH/Artifacts.toml" |
|
|