This commit is contained in:
itswait
2020-08-21 10:31:27 +08:00
parent 3a019a0430
commit 51ad58445e
5 changed files with 37 additions and 61 deletions

View File

@@ -10,21 +10,13 @@ on:
jobs:
Linux:
outputs:
version: ${{ steps.version.outputs.VERSION }}
runs-on: ubuntu-latest
env:
version: ${{ outputs.version }}
steps:
- id: version
run: echo "::set-output name=VERSION::$(cat AV_Data_Capture.py | grep "version = " | tr -d "version = '")"
- uses: actions/checkout@v2
- name: Setup Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.8
@@ -33,21 +25,17 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test number_perser.get_number
- name: Set build version
run: |
python number_parser.py -v
version=$(python -c 'import AV_Data_Capture; print(AV_Data_Capture.__version__)')
echo "::set-env name=VERSION::$version"
- name: Set CLOUDSCRAPER_PATH variable
run: |
echo "::set-env name=CLOUDSCRAPER_PATH::$(python -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1)"
- name: Build with pyinstaller
- name: Build with PyInstaller
run: |
pyinstaller \
--onefile AV_Data_Capture.py \
--hidden-import ADC_function.py \
--hidden-import core.py \
--add-data "$CLOUDSCRAPER_PATH:cloudscraper"
--hidden-import core.py
- name: Copy config.ini
run: |
@@ -56,19 +44,17 @@ jobs:
- name: Upload build artifact
uses: actions/upload-artifact@v1
with:
name: AV_Data_Capture-CLI-${{ env.version }}-Linux
name: AV_Data_Capture-CLI-${{ env.VERSION }}-Linux
path: dist
Windows:
runs-on: windows-latest
needs: Linux
steps:
- uses: actions/checkout@v2
- name: Setup Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.8
@@ -77,21 +63,17 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test number_perser.get_number
- name: Set build version
run: |
python number_parser.py -v
$env:version=$(python -c 'import AV_Data_Capture; print(AV_Data_Capture.__version__)')
echo "::set-env name=VERSION::$env:version"
- name: Set CLOUDSCRAPER_PATH variable
run: |
echo "::set-env name=CLOUDSCRAPER_PATH::$(python -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1)"
- name: Build with pyinstaller
- name: Build with PyInstaller
run: |
pyinstaller `
--onefile AV_Data_Capture.py `
--hidden-import ADC_function.py `
--hidden-import core.py `
--add-data "$env:CLOUDSCRAPER_PATH;cloudscraper"
--hidden-import core.py
- name: Copy config.ini
run: |
@@ -100,19 +82,17 @@ jobs:
- name: Upload build artifact
uses: actions/upload-artifact@v1
with:
name: AV_Data_Capture-CLI-${{ needs.Linux.env.version }}-Windows
name: AV_Data_Capture-CLI-${{ env.VERSION }}-Windows
path: dist
MacOS:
needs: Linux
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.8
@@ -121,21 +101,17 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test number_perser.get_number
- name: Set build version
run: |
python number_parser.py -v
version=$(python -c 'import AV_Data_Capture; print(AV_Data_Capture.__version__)')
echo "::set-env name=VERSION::$version"
- name: Set CLOUDSCRAPER_PATH variable
run: |
echo "::set-env name=CLOUDSCRAPER_PATH::$(python -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1)"
- name: Build with pyinstaller
- name: Build with PyInstaller
run: |
pyinstaller \
--onefile AV_Data_Capture.py \
--hidden-import ADC_function.py \
--hidden-import core.py \
--add-data "$CLOUDSCRAPER_PATH:cloudscraper"
--hidden-import core.py
- name: Copy config.ini
run: |
@@ -144,5 +120,5 @@ jobs:
- name: Upload build artifact
uses: actions/upload-artifact@v1
with:
name: AV_Data_Capture-CLI-${{ needs.Linux.env.version }}-MacOS
name: AV_Data_Capture-CLI-${{ env.VERSION }}-MacOS
path: dist

View File

@@ -59,6 +59,8 @@ def get_html(url, cookies: dict = None, ua: str = None, return_type: str = None)
if return_type == "object":
return result
elif return_type == "json":
return result.json()
else:
return result.text

View File

@@ -3,15 +3,14 @@ from core import *
import os
from number_parser import get_number
__version__ = '3.7.1'
def check_update(local_version):
data = json.loads(get_html("https://api.github.com/repos/yoshiko2/AV_Data_Capture/releases/latest"))
def check_update():
latest = get_html("https://api.github.com/repos/yoshiko2/AV_Data_Capture/releases/latest",
return_type="json")["tag_name"]
remote = data["tag_name"]
local = local_version
if not local == remote:
line1 = "* New update " + str(remote) + " *"
if __version__ != latest:
line1 = "* New update " + str(latest) + " *"
print("[*]" + line1.center(54))
print("[*]" + "↓ Download ↓".center(54))
print("[*] https://github.com/yoshiko2/AV_Data_Capture/releases")
@@ -111,7 +110,6 @@ def create_data_and_move_with_custom_number(file_path: str, c: config.Config, cu
if __name__ == '__main__':
version = '3.7.1'
# Parse command line args
single_file_path, config_file, auto_exit, custom_number = argparse_function()
@@ -119,13 +117,13 @@ if __name__ == '__main__':
# Read config.ini
conf = config.Config(path=config_file)
version_print = 'Version ' + version
version_print = 'Version ' + __version__
print('[*]================== AV Data Capture ===================')
print('[*]' + version_print.center(54))
print('[*]======================================================')
if conf.update_check():
check_update(version)
check_update()
create_failed_folder(conf.failed_folder())
os.chdir(os.getcwd())

View File

@@ -1,5 +1,5 @@
{
. "version": "3.7.1",
"version": "3.7.1",
"version_show": "3.7.1",
"download": "https://github.com/yoshiko2/AV_Data_Capture/releases"
}