Skip to content

Commit

Permalink
adjust tag name strategy, fix missing folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Frefreak committed Feb 20, 2024
1 parent 6a1e828 commit 1b2caff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
cd huma-rime
git status
DATE=$(date +"%Y-%m-%d")
git add .
git commit --all --verbose -m "Automated update on $DATE" || exit 0
git tag ${{ steps.script.outputs.tag }}
git tag
Expand Down
27 changes: 20 additions & 7 deletions crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,30 @@

browser.close()
assert name is not None
m = re.match(r".*(?P<date>\d{4}\.\d{2}\.\d{2})\.zip", name)

# m = re.match(r".*(?P<date>\d{4}\.\d{2}\.\d{2})\.zip", name)
# if m is None:
# print(f"failed to extract date from filename: {name}", file=sys.stderr)
# if ".zip" in name and name.endswith("MB"):
# date = datetime.now().strftime("%Y.%m.%d")
# else:
# exit(1)
# else:
# date = m.group("date")

assert '.zip' in name and name.endswith("MB")
m = re.match(r"虎码秃版 鼠须管 (Mac)(?P<date>.*)\.zip", name)
if m is None:
print(f"failed to extract date from filename: {name}", file=sys.stderr)
if ".zip" in name and name.endswith("MB"):
date = datetime.now().strftime("%Y.%m.%d")
else:
exit(1)
exit(1)
date = m.group('date')

if re.match(r"\d{4}\.\d{2}\.\d{2}", date):
print(f"tag=v{date}")
else:
date = m.group("date")
# not necessarily date, might be a tag
print(f"tag={date}")

print(f"tag=v{date}")
print(f"downloading {name} with url {url}", file=sys.stderr)

urlretrieve(url, ZIP_FILE)
Expand Down

0 comments on commit 1b2caff

Please sign in to comment.