Skip to content

Commit

Permalink
Re-trigger version_metadata on tag release change.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfiex committed Feb 29, 2024
1 parent 03cf7a3 commit 56f4de5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/libs/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ def process_files(files,token = None, branch=None,force=False):
parser = argparse.ArgumentParser(description="Retrieve details for the latest tag of a GitHub repository.")
parser.add_argument("-t", "--token", help="gh token")
parser.add_argument("-b","--branch" ,help="branch name")
parser.add_argument("-n","--newrelease" ,help="tag name")

args = parser.parse_args()

if args.branch == 'main':
process_files(files, token=args.token, branch = args.branch)
if args.newrelease:
process_files(files, token=args.token, branch = args.branch, force = True, )
else:
process_files(files, token=args.token, branch = args.branch)

14 changes: 12 additions & 2 deletions .github/workflows/version_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,18 @@ jobs:

- name: Update Versioning
id: run-python-script
run: python .github/libs/version.py -t ${GH_TOKEN} -b $(git rev-parse --abbrev-ref HEAD)
# working-directory: .github/libs # Adjusted the working directory
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
echo "This is a tag release."
export TAG_NAME=$(echo "${{ github.ref }}" | sed 's|refs/tags/||')
python .github/libs/version.py -t ${GH_TOKEN} -b $(git rev-parse --abbrev-ref HEAD) -n ${TAG_NAME}
else
echo "This is not a tag release."
python .github/libs/version.py -t ${GH_TOKEN} -b $(git rev-parse --abbrev-ref HEAD)
# exit 1
fi
# working-directory: .github/libs # Adjusted the working directory
shell: bash


Expand Down

0 comments on commit 56f4de5

Please sign in to comment.