Skip to content

Commit

Permalink
fix stable automation
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Sep 6, 2024
1 parent 64bb45a commit a4d7e42
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: dev
ref: master
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup Python
uses: actions/setup-python@v1
Expand All @@ -35,7 +35,7 @@ jobs:
python -m pip install build wheel
- name: Remove Alpha tag
run: |
python scripts/remove_alpha.py
python scripts/remove_alpha.py --version-file $GITHUB_WORKSPACE/tutubo/version.py
- name: "Generate release changelog"
uses: heinrichreimer/[email protected]
with:
Expand Down
29 changes: 20 additions & 9 deletions scripts/remove_alpha.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
"""
on merge to master -> declare stable (remove alpha)
"""
import argparse
import fileinput
from os.path import join, dirname
import sys
from os.path import abspath, join, dirname

# TODO - read from env var to allow script to be reused
VERSION_FILE = f"{dirname(dirname(__file__))}/tutubo/version.py"

alpha_var_name = "VERSION_ALPHA"
def update_alpha(version_file):
alpha_var_name = "VERSION_ALPHA"

for line in fileinput.input(VERSION_FILE, inplace=True):
if line.startswith(alpha_var_name):
print(f"{alpha_var_name} = 0")
else:
print(line.rstrip('\n'))
for line in fileinput.input(version_file, inplace=True):
if line.startswith(alpha_var_name):
print(f"{alpha_var_name} = 0")
else:
print(line.rstrip('\n'))


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Update the version based on the specified part (major, minor, build, alpha)')
parser.add_argument('--version-file', help='Path to the version.py file', required=True)

args = parser.parse_args()

update_alpha(abspath(args.version_file))

0 comments on commit a4d7e42

Please sign in to comment.