Skip to content

Commit

Permalink
ci: update yml
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Nov 23, 2024
1 parent 59aea2b commit 3715575
Showing 1 changed file with 82 additions and 76 deletions.
158 changes: 82 additions & 76 deletions .github/workflows/Package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,80 +75,86 @@ jobs:
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_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
uses: softprops/action-gh-release@v2
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
files: |
dist/${{ env.ZIP_NAME }}
# - 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

0 comments on commit 3715575

Please sign in to comment.