ci: update package #8
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Package ocrweb | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| env: | |
| package_name: RapidOCRWeb | |
| rapidocr_web_dir: rapidocr_web/ | |
| jobs: | |
| create_release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| steps: | |
| - name: get_cur_time | |
| uses: srfrnk/current-time@master | |
| id: get_cur_time | |
| with: | |
| format: YYYY-MM-DD-HH-mm-ss | |
| - name: create_release | |
| id: create_release | |
| uses: marvinpinto/action-automatic-releases@latest | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| automatic_release_tag: Release ${{ github.ref_name }} | |
| prerelease: false | |
| draft: true | |
| build_windows: | |
| name: build_windows | |
| runs-on: ${{ matrix.os }} | |
| needs: create_release | |
| strategy: | |
| matrix: | |
| os: ['windows-2022'] | |
| 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 environments | |
| run: | | |
| pip3 install get_pypi_latest_version pyinstaller | |
| pip3 install -r requirements.txt | |
| rapidocr check | |
| - name: Run pyinstaller | |
| id: run_pyinstaller | |
| shell: bash | |
| run: | | |
| cd ${{ env.rapidocr_web_dir }} | |
| pyinstaller ocrweb.spec | |
| cp -r static templates dist/${{ env.package_name }}/_internal | |
| rm dist/${{ env.package_name }}/cv2/opencv_videoio_ffmpe*.dll || echo "未找到opencv_videoio_ffmpeg" | |
| echo "VERSION=$(get_pypi_latest_version rapid_videocr)" >> $GITHUB_OUTPUT | |
| - name: Concat file path | |
| id: concat_file_path | |
| shell: bash | |
| env: | |
| ZIP_WIN_NAME: ${{ env.package_name }}-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer.zip | |
| Win_DIST_DIR: ${{ github.workspace }}\rapidocr_web\dist | |
| run: | | |
| echo "ZIP_NAME=$ZIP_WIN_NAME" >> $GITHUB_OUTPUT | |
| echo "Win_PACKAGE_DIR=$Win_DIST_DIR\${{ env.package_name }}" >> $GITHUB_OUTPUT | |
| echo "Win_ZIP_FULL_PATH=$Win_DIST_DIR\\$ZIP_WIN_NAME" >> $GITHUB_OUTPUT | |
| - name: Zip package | |
| run: | | |
| powershell Compress-Archive ${{ steps.concat_file_path.outputs.Win_PACKAGE_DIR }} ${{ steps.concat_file_path.outputs.Win_ZIP_FULL_PATH }} | |
| - name: Upload release asset | |
| id: upload-release-asset-windows | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.create_release.outputs.upload_url }} | |
| asset_path: ${{ steps.concat_file_path.outputs.Win_ZIP_FULL_PATH }} | |
| asset_name: ${{ steps.concat_file_path.outputs.ZIP_NAME }} | |
| asset_content_type: application/zip | |
| # build_linux: | |
| # name: build_linux | |
| # runs-on: ${{ matrix.os }} | |
| # needs: create_release | |
| # strategy: | |
| # matrix: | |
| # os: ['ubuntu-22.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 environments | |
| # run: | | |
| # pip3 install Pillow pyinstaller Flask>=2.1.0 rapidocr get_pypi_latest_version | |
| # - name: Run pyinstaller | |
| # id: run_pyinstaller | |
| # shell: bash | |
| # run: | | |
| # cd rapidocr_web/ | |
| # pyinstaller ocrweb.spec | |
| # cp -r static templates dist/${{ env.package_name }} | |
| # rm dist/${{ env.package_name }}/cv2/opencv_videoio_ffmpe*.dll || echo "未找到opencv_videoio_ffmpeg" | |
| # echo "VERSION=$(get_pypi_latest_version rapid_videocr)" >> $GITHUB_OUTPUT | |
| # - name: Concat file path | |
| # id: concat_file_path | |
| # env: | |
| # ZIP_NAME: ${{ env.package_name }}-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer.zip | |
| # Linux_DIST_DIR: ${{ github.workspace }}/rapidocr_web/dist | |
| # run: | | |
| # echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT | |
| # echo "Linux_PACKAGE_DIR=$Linux_DIST_DIR/${{ env.package_name }}" >> $GITHUB_OUTPUT | |
| # echo "Linux_ZIP_FULL_PATH=$Linux_DIST_DIR/$ZIP_NAME" >> $GITHUB_OUTPUT | |
| # echo "Linux_DIST_DIR=$Linux_DIST_DIR" >> $GITHUB_OUTPUT | |
| # - name: Zip package | |
| # run: | | |
| # cd ${{ steps.concat_file_path.outputs.Linux_DIST_DIR }} | |
| # zip -r ${{ steps.concat_file_path.outputs.ZIP_NAME }} ${{ env.package_name }} | |
| # - name: Upload release asset | |
| # id: upload-release-asset-linux-macOS | |
| # uses: actions/upload-release-asset@v1 | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # with: | |
| # upload_url: ${{ needs.create_release.outputs.upload_url }} | |
| # asset_path: ${{ steps.concat_file_path.outputs.Linux_ZIP_FULL_PATH }} | |
| # asset_name: ${{ steps.concat_file_path.outputs.ZIP_NAME }} | |
| # asset_content_type: application/zip |