-
Notifications
You must be signed in to change notification settings - Fork 24
95 lines (89 loc) · 3.43 KB
/
windows_x86-64_pack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build windows x86-64 and Python AppImage
on:
push:
branches: [ "master" ]
jobs:
buildWindows:
name: Build windows x86-64
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
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") })
appimage:
name: Build python 3.9 AppImage
needs: buildWindows
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
repository: niess/python-appimage
ref: 'master'
- name: Build
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
python -m python_appimage build manylinux \
2014_x86_64 cp39-cp39
mv python3*.AppImage python3.9-cp39-cp39-manylinux2014_x86_64.AppImage
- name: Upload Appimage
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.uploadReleaseAsset({ owner, repo, release_id: id, name: "python3.9-cp39-cp39-manylinux2014_x86_64.AppImage", data: await fs.readFile("python3.9-cp39-cp39-manylinux2014_x86_64.AppImage") })
}