-
Notifications
You must be signed in to change notification settings - Fork 1
118 lines (95 loc) · 3.58 KB
/
build-beta.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: 'Build (Dev)'
on:
push:
branches:
- master
workflow_dispatch:
jobs:
get-version-number:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Get version number"
id: get_version
run: |
export VERSION=$(python -c 'print(__import__("version").VERSION)')
export SUB_VER=$(git rev-list --no-merges --count $(git describe --tags --abbrev=0)..HEAD)
echo "Currect Version Number: $VERSION.$SUB_VER"
echo "SUB_VER = $SUB_VER" >> version.py
# Create an environment file
echo "VERSION=${VERSION}.${SUB_VER}" >> $GITHUB_OUTPUT
echo "SUB_VERSION=${SUB_VER}" >> $GITHUB_OUTPUT
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
SUB_VERSION: ${{ steps.get_version.outputs.SUB_VERSION }}
build-windows:
needs: get-version-number
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
arch: [x86, x64, arm64]
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Setup Python"
uses: actions/setup-python@v3
with:
python-version: 3.11 # 保证兼容性
- name: "Install requirements"
run: |
python -m pip install --upgrade pip
pip install -U -r requirements.txt
pip install -U nuitka imageio
- name: "Write version number"
run: |
Add-Content -Path "version.py" -Value "SUB_VER = `$env:SUB_VER"
env:
SUB_VER: ${{ needs.get-version-number.outputs.SUB_VERSION }}
- name: "Build executeable"
run: |
python -m nuitka --onefile --standalone --follow-imports --show-modules --mingw64 --output-dir=build --lto=yes --windows-icon-from-ico=icon.ico --windows-file-version=$env:VERSION --windows-product-version=$env:VERSION --show-progress --windows-product-name=OneDisc --windows-file-description="OneBot Implementation for Discord" main.py
env:
VERSION: ${{ needs.get-version-number.outputs.VERSION }}
- name: "Upload build"
uses: actions/upload-artifact@v3
with:
name: OneDisc ${{ needs.get-version-number.outputs.VERSION }} for ${{ matrix.os }}-${{ matrix.arch }}
path: build/*
build:
needs: get-version-number
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
arch: [x86, x64, arm64]
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Setup Python"
uses: actions/setup-python@v3
with:
python-version: 3.11 # 保证兼容性
- name: "Install requirements"
run: |
python -m pip install --upgrade pip
pip install -U -r requirements.txt
pip install -U nuitka
- name: "Write version number"
run: |
echo "SUB_VER = $SUB_VER" >> version.py
env:
SUB_VER: ${{ needs.get-version-number.outputs.SUB_VERSION }}
- name: "Build executeable"
run: |
python -m nuitka --onefile --standalone --follow-imports --show-modules --output-dir=build --lto=yes --show-progress main.py
env:
VERSION: ${{ needs.get-version-number.outputs.VERSION }}
- name: "Upload build"
uses: actions/upload-artifact@v3
with:
name: OneDisc ${{ needs.get-version-number.outputs.VERSION }} for ${{ matrix.os }}-${{ matrix.arch }}
path: build/*