Skip to content

refact actions

refact actions #6

name: Build and Release
on:
workflow_dispatch:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/prod.txt
pip install pyinstaller
- name: Build with PyInstaller
run: pyinstaller nikke_ocr.spec
- name: Prepare release package
run: |
mkdir NIKKE-OCR-release
xcopy /E /I dist\NIKKE-OCR NIKKE-OCR-release
- name: Zip release package
run: Compress-Archive -Path .\NIKKE-OCR-release -DestinationPath .\NIKKE-OCR.zip
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./NIKKE-OCR.zip
asset_name: NIKKE-OCR.zip
asset_content_type: application/zip
- name: Upload artifact for debugging
if: failure()
uses: actions/upload-artifact@v3
with:
name: NIKKE-OCR
path: ./NIKKE-OCR-release