Skip to content

Build and Release

Build and Release #3

name: Build and Release
on:
workflow_dispatch:
push:
tags:
- 'v*'
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\NIKKE-OCR
xcopy /E /I resources NIKKE-OCR-release\resources
copy launcher.py NIKKE-OCR-release\
copy requirements\prod.txt NIKKE-OCR-release\requirements.txt
- name: Zip release package
run: Compress-Archive -Path .\NIKKE-OCR-release -DestinationPath .\NIKKE-OCR.zip
- name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
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
if: startsWith(github.ref, 'refs/tags/v')
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: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v3
with:
name: NIKKE-OCR
path: ./NIKKE-OCR-release