Skip to content

ci: update yml

ci: update yml #15

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.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
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
# - name: Upload release asset
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ZIP_NAME: RapidVideOCR-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer_zh.zip
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: dist/${{ env.ZIP_NAME }}
# asset_name: ${{ env.ZIP_NAME }}
# asset_content_type: application/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.8
# uses: actions/setup-python@v4
# with:
# python-version: '3.8'
# 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 ${{ 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
# - name: Upload release asset
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ZIP_NAME: RapidVideOCR-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer_en.zip
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: dist/${{ env.ZIP_NAME }}
# asset_name: ${{ env.ZIP_NAME }}
# asset_content_type: application/zip