-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update new script and github actions pipeline
- Loading branch information
loris.d
committed
Mar 18, 2024
1 parent
1320c59
commit 761014f
Showing
5 changed files
with
100 additions
and
1 deletion.
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,36 @@ | ||
name: Update Latest Tag | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
tag-latest: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: alpine/git | ||
options: --entrypoint "" | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Necessary for tag manipulation | ||
|
||
# - name: Configure Git | ||
# run: | | ||
# git config --global user.name "Your Name" | ||
# git config --global user.email "[email protected]" | ||
|
||
- name: Remove existing latest tag locally and remotely | ||
run: | | ||
git tag -d latest || true # Ignore error if tag doesn't exist | ||
git push origin :refs/tags/latest || true # Ignore error if tag doesn't exist | ||
- name: Tag HEAD as latest | ||
run: | | ||
git tag latest HEAD | ||
git push origin latest | ||
timeout-minutes: 10 |
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 |
---|---|---|
|
@@ -3,4 +3,6 @@ | |
.*.sw[a-z] | ||
.coverage | ||
.tox | ||
dist | ||
dist | ||
.DS_Store | ||
.vscode/* |
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
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,54 @@ | ||
# Copyright (c) 2014-2024 Zuru Tech HK Limited, All rights reserved. | ||
|
||
"""pre-commit hook that verifies if the .dc files passed are updated to the latest version""" | ||
import io | ||
import json | ||
import re | ||
import sys | ||
|
||
|
||
def verify_file(file_name, version): | ||
"""Verifies if the .dc file schema is at the passed version""" | ||
with io.open(file_name, "r", encoding="utf-8") as fp: | ||
dcfile = json.load(fp) | ||
|
||
if not dcfile["schema"].endswith(f"v{version}/schema.json"): | ||
return False | ||
|
||
return True | ||
|
||
|
||
def main(): | ||
"""Entrypoint""" | ||
|
||
version = "" | ||
with io.open( | ||
"Dreamcatcher/Plugins/BIMCore/Source/DCInterfaces/Public/Source/ExportData/ExpStructs.h", | ||
"r", | ||
encoding="utf-8", | ||
) as fp: | ||
for line in fp: | ||
if "DCFILE_VERSION" in line: | ||
result = re.search(r"DCFILE_VERSION = \"v(\d+)\.(\d+)\.(\d+)\"", line) | ||
if not result: | ||
print("Unable to extract DCFILE_VERSION value", file=sys.stderr) | ||
return 1 | ||
version = f"{result.group(1)}.{result.group(2)}.{result.group(3)}" | ||
break | ||
if not version: | ||
print("Unable to find DCFILE_VERSION", file=sys.stderr) | ||
return 1 | ||
|
||
for dcfile in sys.argv[1:]: | ||
if not dcfile.startswith("-"): | ||
if not verify_file(dcfile, version): | ||
print( | ||
f"{dcfile} not updated to the latest schema version: {version}", | ||
file=sys.stderr, | ||
) | ||
return 1 | ||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
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