|
2 | 2 | import os |
3 | 3 | import sys |
4 | 4 | from pathlib import Path |
| 5 | + |
5 | 6 | script = os.path.abspath(sys.argv[0]) |
6 | | -script_path=Path(script) |
| 7 | +script_path = Path(script) |
7 | 8 | # go up one directories to get the source directory |
8 | 9 | # (this script is in Sire/actions/) |
9 | 10 | srcdir = os.path.dirname(os.path.dirname(script)) |
@@ -50,28 +51,32 @@ def run_cmd(cmd): |
50 | 51 | gitdir = os.path.join(srcdir, ".git") |
51 | 52 |
|
52 | 53 | tag = run_cmd(f"git --git-dir={gitdir} --work-tree={srcdir} tag --contains") |
53 | | -branch = run_cmd(f"git --git-dir={gitdir} branch --show-current") |
| 54 | +# branch = run_cmd(f"git --git-dir={gitdir} branch --show-current") |
54 | 55 | # if the branch is master, then this is a main release |
55 | | -#if tag is not None and tag.lstrip().rstrip() != "": |
| 56 | +# if tag is not None and tag.lstrip().rstrip() != "": |
56 | 57 | # print(f"\nTag {tag} is set. This is a 'main' release.") |
57 | 58 | # label = "--label main" |
58 | | -#else: |
| 59 | +# else: |
59 | 60 | # # this is a development release |
60 | 61 | # print("\nNo tag is set. This is a 'devel' release.") |
61 | 62 | # label = "--label dev" |
62 | | -print("branch is " , branch) |
63 | | -if branch=="master": |
64 | | - print(f"\nBranch {branch} is set. This is a 'main' release.") |
| 63 | + |
| 64 | +# Get the label |
| 65 | +if "CONDA_LABEL" in os.environ: |
| 66 | + branch_label = os.environ["CONDA_LABEL"] |
| 67 | +else: |
| 68 | + branch_label = "TEST" |
| 69 | +print("branch is ", branch_label) |
| 70 | +if branch_label == "master": |
| 71 | + print(f"\nBranch {branch_label} is set. This is a 'main' release.") |
65 | 72 | label = "--label main" |
66 | 73 | else: |
67 | 74 | # this is a development release |
68 | | - print(f"\nBranch {branch} is set. This is a 'devel' release.") |
69 | | - label = "--label dev" |
| 75 | + print(f"\nBranch {branch_label} is set. This is a 'devel' release.") |
| 76 | +# label = "--label dev" |
70 | 77 |
|
71 | 78 | # Upload the packages to the michellab channel on Anaconda Cloud. |
72 | | -cmd = ( |
73 | | - f"anaconda --token {conda_token} upload --user LyceanEM {label} --force {packages}" |
74 | | -) |
| 79 | +cmd = f"anaconda --token {conda_token} upload --user LyceanEM --label {branch_label} --force {packages}" |
75 | 80 |
|
76 | 81 | print(f"\nUpload command:\n\n{cmd}\n") |
77 | 82 |
|
|
0 commit comments