-
Notifications
You must be signed in to change notification settings - Fork 72
122 lines (107 loc) · 3.76 KB
/
pkg.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
119
120
121
122
name: 📦 Package
on:
# Triggers the workflow on push or pull request events but only for the master branch
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
releaseTag:
description: 'Release Tag'
required: true
default: 'v2.x.x[a-z]'
releaseName:
description: 'Release Name'
required: true
default: '2.x.x'
releaseBody:
description: 'Release Body'
required: true
default: 'Enjoy.'
jobs:
build-on-platform:
name: Package on ${{ matrix.version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-2022
version: win_x64
pythonArch: 'x64'
- os: windows-2022
version: win_x86
pythonArch: 'x86'
- os: macos-12
version: mac_intel
pythonArch: 'x64'
- os: ubuntu-22.04
version: ubuntu_x64
pythonArch: 'x64'
steps:
- uses: actions/checkout@v4
- name: Classify files, prepare to be packaged
run: |
mkdir ./.pkg/code
mkdir ./.pkg/public
cp -r ./altfe/ ./.pkg/code/altfe/
cp -r ./app/ ./.pkg/code/app/
cp ./main.py ./.pkg/code/
cp -r ./usr/ ./.pkg/public/usr/
cp ./app/config/biu_default.yml ./.pkg/public/config.yml
cp ./LICENSE ./.pkg/public/
cp ./README.md ./.pkg/public/
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.7'
architecture: ${{ matrix.pythonArch }}
- name: Install Requirements
run: |
pip install -r ./requirements.txt
pip install pyinstaller
- name: Run py-pkger.py
run: |
cd ./.pkg/
python ./py-pkger.py auto
- name: Compress to ZIP (win)
if: ${{ contains(matrix.version, 'win') }}
run: |
cd ./.pkg/dist/
mv ./main.exe ./PixivBiu.exe
Compress-Archive * ../../${{ matrix.version }}.zip
- name: Compress to ZIP (unix-like)
if: ${{ contains(matrix.version, 'mac') || contains(matrix.version, 'ubuntu') }}
run: |
cd ./.pkg/dist/
mv ./main ./PixivBiu
zip -r ../../${{ matrix.version }}.zip *
- name: Upload to Artifact
uses: actions/upload-artifact@v3
with:
name: pixivbiuArt
path: ./${{ matrix.version }}.zip
Release:
needs: [build-on-platform]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Download from Artifact
uses: actions/download-artifact@v3
with:
name: pixivbiuArt
- name: Rename
run: |
mv ./win_x64.zip ./PixivBiu_${{ github.event.inputs.releaseTag }}_win_x64.zip
mv ./win_x86.zip ./PixivBiu_${{ github.event.inputs.releaseTag }}_win_x86.zip
mv ./mac_intel.zip ./PixivBiu_${{ github.event.inputs.releaseTag }}_mac_intel.zip
mv ./ubuntu_x64.zip ./PixivBiu_${{ github.event.inputs.releaseTag }}_ubuntu_x64.zip
- name: Release and Done
uses: ncipollo/release-action@v1
with:
artifacts: "PixivBiu_${{ github.event.inputs.releaseTag }}_win_x64.zip, PixivBiu_${{ github.event.inputs.releaseTag }}_win_x86.zip, PixivBiu_${{ github.event.inputs.releaseTag }}_mac_intel.zip, PixivBiu_${{ github.event.inputs.releaseTag }}_ubuntu_x64.zip"
tag: ${{ github.event.inputs.releaseTag }}
name: ${{ github.event.inputs.releaseName }}
body: ${{ github.event.inputs.releaseBody }}
token: ${{ secrets.GITHUB_TOKEN }}