-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>sed-processor documentation</title> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="refresh" content="0; URL=https://opencompes.github.io/docs/sed/stable/" /> | ||
</head> | ||
<body> | ||
<p><a href="https://opencompes.github.io/docs/sed/stable/">Here</a> you find the last stable documentation of sed-processor.</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[ | ||
{ | ||
"name": "latest", | ||
"version": "0.3.3a3", | ||
"url": "https://opencompes.github.io/docs/specsanalyzer/latest" | ||
}, | ||
{ | ||
"name": "stable", | ||
"version": "0.3.2", | ||
"url": "https://opencompes.github.io/docs/specsanalyzer/v0.3.2", | ||
"preferred": "true" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import json | ||
import sys | ||
|
||
if len(sys.argv) != 4: | ||
sys.exit("Usage: update_switcher.py json_file GITHUB_REF VERSION") | ||
|
||
switcher_file = sys.argv[1] | ||
branch = sys.argv[2] | ||
version = sys.argv[3] | ||
|
||
present = False | ||
with open(switcher_file, encoding="utf-8") as f: | ||
data = json.load(f) | ||
if branch.startswith("refs/tags"): # add a new version tag | ||
version_tag = branch.split("/")[-1] | ||
for item in data: | ||
if version_tag in item.get("name", ""): | ||
present = True | ||
if "stable" in item.get("name", ""): | ||
item["version"] = version | ||
item["url"] = "https://opencompes.github.io/docs/specsanalyzer/" + version_tag | ||
if not present: | ||
new_entry = {} | ||
new_entry["name"] = version_tag | ||
new_entry["version"] = version | ||
new_entry["url"] = "https://opencompes.github.io/docs/specsanalyzer/" + version_tag | ||
data.append(new_entry) | ||
|
||
elif branch == "refs/heads/main": # update latest | ||
for item in data: | ||
if "latest" in item.get("name", ""): | ||
item["version"] = version | ||
present = True | ||
break | ||
if not present: | ||
new_entry = {} | ||
new_entry["name"] = "latest" | ||
new_entry["version"] = version | ||
new_entry["url"] = "https://opencompes.github.io/docs/specsanalyzer/latest" | ||
data.append(new_entry) | ||
|
||
else: # update develop | ||
for item in data: | ||
if "develop" in item.get("name", ""): | ||
present = True | ||
item["version"] = version | ||
break | ||
if not present: | ||
new_entry = {} | ||
new_entry["name"] = "develop" | ||
new_entry["version"] = version | ||
new_entry["url"] = "https://opencompes.github.io/docs/specsanalyzer/develop" | ||
data.append(new_entry) | ||
|
||
print(data) | ||
|
||
with open(switcher_file, mode="w", encoding="utf-8") as f: | ||
json.dump(data, f, indent=2) |