Skip to content

feat: use ppocr_v5 model #33

feat: use ppocr_v5 model

feat: use ppocr_v5 model #33

Workflow file for this run

name: install
on:
push:
tags:
- "v*"
branches:
- "**"
paths:
- ".github/workflows/install.yml"
- "assets/**"
- "**.py"
pull_request:
branches:
- "**"
paths:
- ".github/workflows/install.yml"
- "assets/**"
- "**.py"
workflow_dispatch:
jobs:
meta:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: set_tag
run: |
is_release=${{ startsWith(github.ref, 'refs/tags/v') }}
tag=$(git describe --tags --match "v*" ${{ github.ref }} || true)
if [[ $tag != v* ]]; then
tag=$(curl -sX GET "https://api.github.com/repos/${{ github.repository }}/releases/latest" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | awk '/tag_name/{print $4}' FS='["]')
if [[ $tag != v* ]]; then
tag="v0.0.0"
fi
tag=$(date "+$tag-%y%m%d-$(git rev-parse --short HEAD)")
fi
if ! $($is_release) ; then
prefix=${tag%-*-*}
suffix=${tag#$prefix-}
tag="$prefix-ci.$suffix"
fi
echo tag=$tag | tee -a $GITHUB_OUTPUT
echo is_release=$is_release | tee -a $GITHUB_OUTPUT
outputs:
tag: ${{ steps.set_tag.outputs.tag }}
is_release: ${{ steps.set_tag.outputs.is_release }}
install:
needs: meta
runs-on: macos-latest
strategy:
matrix:
os: [win, macos, linux, android]
arch: [aarch64, x86_64]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download MaaFramework
uses: robinraju/release-downloader@v1
with:
repository: MaaXYZ/MaaFramework
fileName: "MAA-${{ matrix.os }}-${{ matrix.arch }}*"
latest: true
out-file-path: "deps"
extract: true
- name: Download MFAAvalonia
if: matrix.os != 'android'
uses: robinraju/release-downloader@v1
with:
repository: SweetSmellFox/MFAAvalonia
fileName: "MFAAvalonia-*-${{ (matrix.os == 'win' && 'win') || (matrix.os == 'macos' && 'osx') || (matrix.os == 'linux' && 'linux') }}-${{ (matrix.arch == 'x86_64' && 'x64') || (matrix.arch == 'aarch64' && 'arm64') }}*"
latest: true
out-file-path: "MFA"
extract: true
- name: Clean up MFAAvalonia archive
if: matrix.os != 'android'
shell: bash
run: |
OS_NAME=""
if [[ "${{ matrix.os }}" == "win" ]]; then
OS_NAME="win"
elif [[ "${{ matrix.os }}" == "macos" ]]; then
OS_NAME="osx"
elif [[ "${{ matrix.os }}" == "linux" ]]; then
OS_NAME="linux"
fi
ARCH_NAME=""
if [[ "${{ matrix.arch }}" == "x86_64" ]]; then
ARCH_NAME="x64"
elif [[ "${{ matrix.arch }}" == "aarch64" ]]; then
ARCH_NAME="arm64"
fi
if [[ -n "$OS_NAME" && -n "$ARCH_NAME" ]]; then
ARCHIVE_PATTERN="MFAAvalonia-*-${OS_NAME}-${ARCH_NAME}*"
echo "Attempting to remove downloaded archive matching: ${ARCHIVE_PATTERN}"
rm -f ${ARCHIVE_PATTERN}
echo "Archive cleanup command executed for MFAAvalonia."
else
echo "OS or Arch name not determined for this matrix combination, skipping MFAAvalonia archive cleanup."
fi
- name: Install
shell: bash
run: |
python ./install.py ${{ needs.meta.outputs.tag }}
if [[ "${{ matrix.os }}" != "android" ]]; then
if [ -d "MFA" ]; then
echo "Copying MFA files to install directory..."
mkdir -p install
rsync -av --ignore-existing MFA/ install/
else
echo "MFA directory not found, skipping copy."
fi
else
echo "Skipping copy MFA for Android."
fi
- uses: actions/upload-artifact@v4
with:
name: MaaXXX-${{ matrix.os }}-${{ matrix.arch }}
path: "install"
release:
if: ${{ needs.meta.outputs.is_release == 'true' }}
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: assets
- run: |
cd assets
for f in *; do
(cd $f && zip -r ../$f-${{ needs.meta.outputs.tag }}.zip .)
done
- uses: softprops/action-gh-release@v2
with:
files: assets/*
tag_name: ${{ needs.meta.outputs.tag }}
generate_release_notes: true