mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-31 20:54:51 +00:00
PyroFork: Publish dev build
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
a6bced2bc5
commit
24d933b7c1
2 changed files with 31 additions and 2 deletions
27
.github/utils/randomize.py
vendored
Normal file
27
.github/utils/randomize.py
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import datetime
|
||||
import random
|
||||
import re
|
||||
import string
|
||||
|
||||
with open("pyrogram/__init__.py", "r") as f:
|
||||
pyro_version = re.findall(r"__version__ = \"(.+)\"", f.read())[0]
|
||||
date = datetime.datetime.now().strftime("%Y%m%d")
|
||||
dev_version = ''.join(random.choice(string.digits) for i in range(4))
|
||||
version = f"{pyro_version}.dev{date}{dev_version}"
|
||||
|
||||
with open("pyrogram/__init__.py", "r") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
with open("pyrogram/__init__.py", "w") as f:
|
||||
for line in lines:
|
||||
line = re.sub(r'__fork_name__ = "PyroFork"', '__fork_name__ = "PyroFork-dev"', line)
|
||||
line = re.sub(r'^__version__ = "'+ pyro_version +'"', '__version__ = "'+ version +'"', line)
|
||||
f.write(line)
|
||||
|
||||
with open("setup.py", "r") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
with open("setup.py", "w") as f:
|
||||
for line in lines:
|
||||
line = re.sub(r' name="PyroFork"', ' name="PyroFork-dev"', line)
|
||||
f.write(line)
|
||||
6
.github/workflows/python-publish.yml
vendored
6
.github/workflows/python-publish.yml
vendored
|
|
@ -9,8 +9,9 @@
|
|||
name: Upload Python Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
push:
|
||||
branches:
|
||||
- staging
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -30,6 +31,7 @@ jobs:
|
|||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build twine
|
||||
python .github/utils/randomize.py
|
||||
- name: Build package
|
||||
run: python -m build
|
||||
- name: Publish package
|
||||
|
|
|
|||
Loading…
Reference in a new issue