Skip to content

[#]修复OCR可能导致的权限问题 #106

[#]修复OCR可能导致的权限问题

[#]修复OCR可能导致的权限问题 #106

name: Build windows x86-64
on:
push:
branches: [ "master" ]
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
path: HikariBot
ref: 'master'
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.10
- name: Latest-tag
run: |
cd HikariBot
git tag Latest --force
git push --force origin refs/tags/Latest:refs/tags/Latest
cd ..
- name: Prepare phthon environment with conda
shell: cmd
run: |
cd HikariBot
call %CONDA%/condabin/conda.bat create --prefix .\pyenv python
call %CONDA%/condabin/conda.bat activate .\pyenv
python -m pip install --upgrade pip
python -m pip install nb-cli hikari-bot nonebot2[fastapi] hikari-core
python -m pip install nonebot-plugin-apscheduler
python -m pip install nonebot-plugin-gocqhttp
python -m pip install nonebot-plugin-guild-patch
set PLAYWRIGHT_BROWSERS_PATH=0
python -m playwright install chromium
call %CONDA%/condabin/conda.bat deactivate
attrib -h .git
cd ..
- name: Pack windows x86-64 version
shell: pwsh
run: |
$tmp = Get-Content "HikariBot\.git\config"
echo $tmp |Select-String -NotMatch -Pattern "extraheader" | Set-Content "HikariBot\.git\config"
Compress-Archive -DestinationPath release.zip -Path HikariBot
- name: Delete and create latest release
uses: actions/github-script@v6
with:
script: |
const fs = require("fs").promises;
const { owner, repo } = context.repo
const { data } = await github.rest.repos.listReleases({ owner, repo })
if ( data.length > 0){
const { data: { id } } = await github.rest.repos.getLatestRelease({ owner, repo })
await github.rest.repos.deleteRelease({ owner, repo, release_id: id })
}
const { data: { id } } = await github.rest.repos.createRelease({ owner, repo, tag_name: "Latest", name: "Latest Release" })
await github.rest.repos.uploadReleaseAsset({ owner, repo, release_id: id, name: "release_windows.zip", data: await fs.readFile("release.zip") })