Skip to content

Commit

Permalink
Create update_version.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Carter committed Feb 27, 2024
1 parent 6c173f4 commit a58ad2c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2.3.3
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/scripts/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
result = run(command, shell=True, capture_output=True)
if result.returncode != 0:
print(f"Failed to run {command} with error {result.returncode}:\n{result.stderr.decode(encoding='utf-8')}")
exit(result.returncode)

version = result.stdout.decode(encoding="utf-8").strip()
print(version)
# Our tagging convention is v{version_year}_{version_month}
# git describe will sometimes return something like v2024_02-5-g5f0770a64e
version_year = int(version.split("_")[0][1:]) # Split the year and month based on the '_', and strip off the leading 'v'
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/update_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Update Version Info

on:
push:
tags: [ "release" ]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v2.3.3

- name: Update Version Files
run: |
python3 .github/workflows/scripts/update_version.py
- uses: EndBug/add-and-commit@v9

- name: Update Existing Tag
run: |
CURRENT_TAG=$(git describe --abbrev=0 --tags)
git tag -f $CURRENT_TAG
git push --tags --force

0 comments on commit a58ad2c

Please sign in to comment.