qiaojunfeng commited on
Commit
2b20330
·
1 Parent(s): 61de2dc

Clean up release process

Browse files
Files changed (6) hide show
  1. .bumpversion.toml +7 -0
  2. .gitignore +1 -0
  3. Artifacts.toml +0 -87
  4. docs/CONTRIBUTING.md +1 -11
  5. make_artifacts.jl +0 -18
  6. release.sh +65 -0
.bumpversion.toml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [tool.bumpversion]
2
+ current_version = "0.0.0"
3
+ tag = true
4
+ allow_dirty = true
5
+ commit = true
6
+ pre_commit_hooks = []
7
+ post_commit_hooks = []
.gitignore CHANGED
@@ -26,6 +26,7 @@ Manifest.toml
26
  # Do not commit large (and redundant) tar.gz files, instead, I upload them
27
  # to the `artifacts` branch
28
  artifacts/*.tar.gz
 
29
 
30
  # vscode
31
  .vscode
 
26
  # Do not commit large (and redundant) tar.gz files, instead, I upload them
27
  # to the `artifacts` branch
28
  artifacts/*.tar.gz
29
+ Artifacts.toml
30
 
31
  # vscode
32
  .vscode
Artifacts.toml DELETED
@@ -1,87 +0,0 @@
1
- [Cu]
2
- git-tree-sha1 = "7a62b6fd9cf0b8414d402bf5109ab1e4e3770812"
3
- lazy = true
4
-
5
- [[Cu.download]]
6
- sha256 = "1a140584aab78b59171bb75c4d4e741646a0e7162dd50577f771f3287fc62128"
7
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/Cu.tar.gz"
8
-
9
- [Si2_valence]
10
- git-tree-sha1 = "69abcb33e42a08354b68dae0c4ced116b6234d70"
11
- lazy = true
12
-
13
- [[Si2_valence.download]]
14
- sha256 = "ed279ed6d3f6fbd7d953633d0574230d3d405eefc6798a59e587fa8ebe175446"
15
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/Si2_valence.tar.gz"
16
-
17
- [CrI3]
18
- git-tree-sha1 = "888fc3a5816e746cf3b7ddd2c469b89ae0f7e7da"
19
- lazy = true
20
-
21
- [[CrI3.download]]
22
- sha256 = "5f24343dd393117213a329f8f850e3e967b91634ea1f6723cc5a3c1a1a55be2b"
23
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/CrI3.tar.gz"
24
-
25
- [MoS2]
26
- git-tree-sha1 = "2b36703f7e686b5b3e40bcdbd86688e80be4a4d6"
27
- lazy = true
28
-
29
- [[MoS2.download]]
30
- sha256 = "37127125dbf63455034bf918186b4bbe87d8b6739d4fd217f05e060b54aa9fc1"
31
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/MoS2.tar.gz"
32
-
33
- [BN]
34
- git-tree-sha1 = "5c6644b683c4783271d99973e21156daa2075bac"
35
- lazy = true
36
-
37
- [[BN.download]]
38
- sha256 = "af312e7f4e5b75765abd669934660e13048cf9cc402b105416a449a35290d55e"
39
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/BN.tar.gz"
40
-
41
- [SnSe2]
42
- git-tree-sha1 = "b45310314ba59112420850678fa416fcbbd7aa6a"
43
- lazy = true
44
-
45
- [[SnSe2.download]]
46
- sha256 = "8ed6355a0746a7b69e48080abc60e5beda324591b46ef5f3e5325407d1917d38"
47
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/SnSe2.tar.gz"
48
-
49
- [Fe_collinear]
50
- git-tree-sha1 = "7491f2d773a5f682f83cf46120ae3ef8430c0f99"
51
- lazy = true
52
-
53
- [[Fe_collinear.download]]
54
- sha256 = "176e34a5a5786fdcc12175444bde251a320150ddf5f4040fb91d2bfc5ac94f65"
55
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/Fe_collinear.tar.gz"
56
-
57
- [Fe_soc]
58
- git-tree-sha1 = "61ccd2c018e0934c3541b85c32a8bd0ee957e2d7"
59
- lazy = true
60
-
61
- [[Fe_soc.download]]
62
- sha256 = "7effe3c3827c23571d970e69db4499a068e1bbdce3ae18be10532e7d21bd9e1c"
63
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/Fe_soc.tar.gz"
64
-
65
- [graphene]
66
- git-tree-sha1 = "600f801c60eba4eb34c7d6396de079a597bc29cc"
67
- lazy = true
68
-
69
- [[graphene.download]]
70
- sha256 = "b9f399a3875fa1cff5dc95437c863b4b1090d3658e48be6724a54cbffb3175a2"
71
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/graphene.tar.gz"
72
-
73
- [CuBr2]
74
- git-tree-sha1 = "1cb8c060dd58a341f243216ba96932660f7310d4"
75
- lazy = true
76
-
77
- [[CuBr2.download]]
78
- sha256 = "7d305aea2ddfbb6e7d9036e6110c4e7272e5ba90544532681d622cf2fdb1aaa0"
79
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/CuBr2.tar.gz"
80
-
81
- [Si2]
82
- git-tree-sha1 = "1459f891f478ff64c3d1296c634ad441611778b2"
83
- lazy = true
84
-
85
- [[Si2.download]]
86
- sha256 = "0dcdd64a0955a88258dd839687469449e9c5aae9a5c20335fb3cec840dba917a"
87
- url = "https://huggingface.co/datasets/atomology/WannierDatasets/resolve/artifacts/Si2.tar.gz"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/CONTRIBUTING.md CHANGED
@@ -61,14 +61,4 @@ We actively welcome your pull requests:
61
 
62
  ## Release process
63
 
64
- ```shell
65
- # make tarballs
66
- ./make_artifacts.jl
67
-
68
- # upload tarballs to huggingface `artifacts` branch, see the output of `make_artifacts.jl`
69
- huggingface-cli upload # ...
70
-
71
- # auto bump the version & create git tag with release-it
72
- # https://github.com/release-it/release-it
73
- release-it --no-push
74
- ```
 
61
 
62
  ## Release process
63
 
64
+ See [`../release.sh`](../release.sh).
 
 
 
 
 
 
 
 
 
 
make_artifacts.jl CHANGED
@@ -134,22 +134,6 @@ function list_new_folders()
134
  return new_folders
135
  end
136
 
137
- function upload_artifacts(names::AbstractVector)
138
- files = join(["$(n).tar.gz" for n in names], "\n")
139
- println("\n\n# $(length(names)) Files to be uploaded to huggingface")
140
-
141
- commit_msg = "Upload artifacts v1.1.0"
142
- commit_desc = files
143
- println()
144
- println("huggingface-cli upload " *
145
- "atomology/WannierDatasets $artifacts_dir . " *
146
- "--repo-type dataset " *
147
- "--revision $deploy_branch " *
148
- "--include \"*.tar.gz\" " *
149
- "--commit-message \"$commit_msg\" " *
150
- "--commit-description \"$commit_desc\"")
151
- end
152
-
153
  function clean_artifacts_dir()
154
  print("I will clean the `$(artifacts_dir)` folder [y/N]: ")
155
  n = readline()
@@ -186,6 +170,4 @@ function (@main)(args)
186
  TOML.print(io, artifacts)
187
  end
188
  end
189
-
190
- upload_artifacts(new_folders)
191
  end
 
134
  return new_folders
135
  end
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  function clean_artifacts_dir()
138
  print("I will clean the `$(artifacts_dir)` folder [y/N]: ")
139
  n = readline()
 
170
  TOML.print(io, artifacts)
171
  end
172
  end
 
 
173
  end
release.sh ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # This script automates the process of releasing a new version of the dataset.
3
+ # Usage: ./release.sh <major|minor|patch>
4
+ set -e
5
+
6
+ # 1. Make sure you have git commit all the changes
7
+ if test -n "$(git status --porcelain)"; then
8
+ echo "Please commit all changes before running this script."
9
+ exit 1
10
+ fi
11
+ # and the git branch should be `main`
12
+ if [[ $(git branch --show-current) != "main" ]]; then
13
+ echo "Please run this script on the main branch."
14
+ exit 1
15
+ fi
16
+
17
+ # 2. Decide the next version number--which component to bump?
18
+ if [ -z "$1" ]; then
19
+ echo "Please provide the version component to bump (major, minor, patch)."
20
+ exit 2
21
+ fi
22
+ if [ "$1" != "major" ] && [ "$1" != "minor" ] && [ "$1" != "patch" ]; then
23
+ echo "Invalid version component. Use major, minor, or patch."
24
+ exit 2
25
+ fi
26
+ C=$1
27
+ OLD_VERSION=`bump-my-version show current_version`
28
+ NEW_VERSION=`bump-my-version show new_version --increment $C`
29
+ # bump-my-version bump --dry-run -v $C
30
+ echo -n "Bumping version $C, $OLD_VERSION → $NEW_VERSION. Are you sure? (y/N) "
31
+ read -r answer
32
+ if [[ ! $answer =~ ^[Yy]$ ]]; then
33
+ echo "Aborting."
34
+ exit 3
35
+ fi
36
+
37
+ # 3. Git fetch to make sure the `artifacts` branch is up to date
38
+ DEPLOY_BRANCH=artifacts
39
+ git fetch origin $DEPLOY_BRANCH:$DEPLOY_BRANCH
40
+ # Then make tarballs, which will compare against the `artifacts` branch
41
+ # and create tarballs only for the new/changed datasets
42
+ ./make_artifacts.jl
43
+ mv Artifacts.toml artifacts/
44
+
45
+ # 4. Auto bump the version & create git tag with bump-my-version
46
+ # https://github.com/callowayproject/bump-my-version
47
+ bump-my-version bump $C
48
+
49
+ # 5. Upload tarballs to huggingface `artifacts` branch
50
+ ARTIFACTS_DIR=artifacts
51
+ COMMIT_MSG="Update artifacts v$OLD_VERSION → v$NEW_VERSION"
52
+ # list of tarballs
53
+ COMMIT_DESC=`find "$ARTIFACTS_DIR" -type f -exec basename {} \;`
54
+ huggingface-cli upload \
55
+ atomology/WannierDatasets $ARTIFACTS_DIR . \
56
+ --repo-type dataset \
57
+ --revision $DEPLOY_BRANCH \
58
+ --include "*" \
59
+ --commit-message "$COMMIT_MSG" \
60
+ --commit-description "$COMMIT_DESC"
61
+
62
+ # 6. Check results
63
+ echo "Upload complete. Checking results at"
64
+ echo "https://huggingface.co/datasets/atomology/WannierDatasets/tree/$DEPLOY_BRANCH"
65
+ echo "https://huggingface.co/datasets/atomology/WannierDatasets/main/Artifacts.toml"