Skip to content

Manual Build

Manual Build #17

Workflow file for this run

name: Manual Build
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
environment: KeywordGacha
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Create Env
run: |
powershell -Command "Expand-Archive -Path 'resource\WinPython64.zip' -DestinationPath 'env'"
- name: Install Requirements
run: |
# 激活虚拟环境(每一步都要激活)
env\scripts\activate
# 安装依赖
pip install --upgrade pip
pip install -r requirements.txt
python -m spacy download ja_core_news_lg
- name: Copy Files
run: |
xcopy "env" "dist\KeywordGacha\env" /E /I /H /Y
xcopy "model" "dist\KeywordGacha\model" /E /I /H /Y
xcopy "helper" "dist\KeywordGacha\helper" /E /I /H /Y
xcopy "prompt" "dist\KeywordGacha\prompt" /E /I /H /Y
copy "00_启动.bat" "dist\KeywordGacha\"
copy "main.py" "dist\KeywordGacha\"
copy "config.json" "dist\KeywordGacha\"
copy "blacklist.txt" "dist\KeywordGacha\"
- name: Compress Archive
id: compress_files
shell: pwsh
run: |
# 获取当前UTC时间
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
# 调整为东八区时间(北京时间)
$timestamp = ([System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId([datetime]::ParseExact($timestamp, "yyyyMMdd_HHmmss", $null), [System.TimeZoneInfo]::Utc.Id, 'China Standard Time')).ToString("yyyyMMdd_HHmmss")
# 压缩dist目录下的所有文件,不包括dist目录本身
Compress-Archive -Path "dist\*" -DestinationPath "KeywordGacha_DEV_$timestamp.zip" -Force
# 输出 timestamp 变量以供后续步骤使用
echo "::set-output name=timestamp::$timestamp"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.KEYWORDGACHA_TOKEN }}
with:
tag_name: MANAUL_BUILD_${{ steps.compress_files.outputs.timestamp }}
release_name: KeywordGacha_DEV_${{ steps.compress_files.outputs.timestamp }}
draft: false
prerelease: false
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.KEYWORDGACHA_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./KeywordGacha_DEV_${{ steps.compress_files.outputs.timestamp }}.zip
asset_name: KeywordGacha_DEV_${{ steps.compress_files.outputs.timestamp }}.zip
asset_content_type: application/octet-stream