Skip to content

fix: fixed issue #7 #17

fix: fixed issue #7

fix: fixed issue #7 #17

Workflow file for this run

name: Auto generate exe
on:
push:
tags:
- v*
jobs:
create_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: create_release
id: create_release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: ${{ github.ref_name }}
prerelease: false
draft: true
build_zh:
name: build_zh
runs-on: ${{ matrix.os }}
needs: create_release
strategy:
matrix:
os: ['ubuntu-22.04', 'windows-2022', 'ubuntu-20.04']
steps:
- name: Pull latest code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install env
run: |
pip3 install pyqt5 pyinstaller tqdm rapidocr_onnxruntime get_pypi_latest_version rapid_videocr
- name: Run pyinstaller
id: run_pyinstaller
shell: bash
run: |
mv ui/* .
py_path="RapidVideOCR.py"
line_num=$(sed -n "/self.version = /=" $py_path)
new_version="${{ github.ref_name }}"
sed -i "${line_num}d" $py_path
sed -i "${line_num}i\ self.version = '${new_version}'" $py_path
pyinstaller RapidVideOCR.spec
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- if: matrix.os == 'windows-2022'
name: zip the artifact dir into a zip
env:
ZIP_NAME: RapidVideOCR-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer_zh.zip
run: |
powershell Compress-Archive ${{ github.workspace }}\dist\RapidVideOCR ${{ github.workspace }}\dist\${{ env.ZIP_NAME }}
- if: matrix.os != 'windows-2022'
env:
ZIP_NAME: RapidVideOCR-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer_zh.zip
run: |
cd $GITHUB_WORKSPACE/dist/
zip -r ${{ env.ZIP_NAME }} RapidVideOCR
- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
files: dist/*.zip
build_en:
name: build_en
runs-on: ${{ matrix.os }}
needs: create_release
strategy:
matrix:
os: ['ubuntu-22.04', 'windows-2022', 'ubuntu-20.04']
steps:
- name: Pull latest code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install env
run: |
pip3 install pyqt5 pyinstaller tqdm rapidocr_onnxruntime get_pypi_latest_version rapid_videocr
- name: Run pyinstaller
id: run_pyinstaller
shell: bash
run: |
mv ui/* .
py_path="RapidVideOCR_En.py"
line_num=$(sed -n "/self.version = /=" $py_path)
new_version="${{ github.ref_name }}"
sed -i "${line_num}d" $py_path
sed -i "${line_num}i\ self.version = '${new_version}'" $py_path
sed -i "s/RapidVideOCR/RapidVideOCR_En/" RapidVideOCR.spec
pyinstaller RapidVideOCR.spec
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- if: matrix.os == 'windows-2022'
name: zip the artifact dir into a zip
env:
ZIP_NAME: RapidVideOCR-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer_en.zip
run: |
powershell Compress-Archive ${{ github.workspace }}\dist\RapidVideOCR_En ${{ github.workspace }}\dist\${{ env.ZIP_NAME }}
- if: matrix.os != 'windows-2022'
env:
ZIP_NAME: RapidVideOCR-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer_en.zip
run: |
cd $GITHUB_WORKSPACE/dist/
zip -r ${{ env.ZIP_NAME }} RapidVideOCR_En
- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
files: dist/*.zip