From 5581f385ae02f5bda155e89423480aadc5aab63d Mon Sep 17 00:00:00 2001 From: Gres Date: Sat, 5 Feb 2022 20:32:16 +0300 Subject: [PATCH] Added joint script to make a release --- .github/workflows/build.yml | 51 +++-------------------------------- share/ci/release.py | 53 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 48 deletions(-) create mode 100644 share/ci/release.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9860dce..188e869 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,56 +63,11 @@ jobs: path: deps key: ${{ env.OS }}-deps - - name: Get Qt - run: python ./share/ci/get_qt.py - - - name: Get ssl - run: python ./share/ci/get_qt_ssl.py - - - name: Get leptonica - run: python ./share/ci/get_leptonica.py - - - name: Get tesseract optimized - env: - MARCH: sandy-bridge - TAG: optimized - run: python ./share/ci/get_tesseract.py - - - name: Get tesseract compatible - env: - MARCH: nehalem - TAG: compatible - run: python ./share/ci/get_tesseract.py - - - name: Get hunspell - run: python ./share/ci/get_hunspell.py - - - name: Test - run: python ./share/ci/test.py - - - name: Build - run: python ./share/ci/build.py - - - name: Create AppImage - if: runner.os == 'Linux' + - name: Make a release shell: bash run: | - python ./share/ci/appimage.py - echo "artifact=`python ./share/ci/appimage.py artifact_name`" >> $GITHUB_ENV - - - name: Create win deploy - if: runner.os == 'Windows' - shell: bash - run: | - python ./share/ci/windeploy.py - echo "artifact=`python ./share/ci/windeploy.py artifact_name`" >> $GITHUB_ENV - - - name: Create mac deploy - if: runner.os == 'macOS' - shell: bash - run: | - python ./share/ci/macdeploy.py - echo "artifact=`python ./share/ci/macdeploy.py artifact_name`" >> $GITHUB_ENV + python ./share/ci/release.py + echo "artifact=`python ./share/ci/release.py artifact_name`" >> $GITHUB_ENV - name: Upload build artifact if: env.artifact != '' diff --git a/share/ci/release.py b/share/ci/release.py new file mode 100644 index 0000000..68a7d69 --- /dev/null +++ b/share/ci/release.py @@ -0,0 +1,53 @@ +import os +import platform +import sys +import subprocess + +here = os.path.dirname(__file__) + + +def r_out(script, args): + return subprocess.run([sys.executable, os.path.join(here, script)] + args, check=True, stdout=subprocess.PIPE).stdout.decode('utf-8').strip() + + +if len(sys.argv) > 1 and sys.argv[1] == 'artifact_name': + artifact_name = '' + if platform.system() == "Linux": + artifact_name = r_out('appimage.py', ['artifact_name']) + if platform.system() == "Windows": + artifact_name = r_out('windeploy.py', ['artifact_name']) + if platform.system() == "Darwin": + artifact_name = r_out('macdeploy.py', ['artifact_name']) + print(artifact_name) + exit(0) + + +def r(script): + return subprocess.run([sys.executable, os.path.join(here, script)], check=True) + + +r('get_qt.py') +r('get_qt_ssl.py') +r('get_leptonica.py') + +os.environ['MARCH'] = 'sandy-bridge' +os.environ['TAG'] = 'optimized' +r('get_tesseract.py') + +os.environ['MARCH'] = 'nehalem' +os.environ['TAG'] = 'compatible' +r('get_tesseract.py') + +del os.environ['MARCH'] +del os.environ['TAG'] + +r('get_hunspell.py') +r('test.py') +r('build.py') + +if platform.system() == "Linux": + r('appimage.py') +if platform.system() == "Windows": + r('windeploy.py') +if platform.system() == "Darwin": + r('macdeploy.py')