-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (131 loc) · 5 KB
/
build.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Cross-Platform Build
on:
# push:
# branches:
# - main
# pull_request:
# branches:
# - main
workflow_dispatch:
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
short_sha: ${{ steps.short_sha.outputs.short_sha }}
steps:
- name: Set sha
id: short_sha
run: echo "short_sha=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT
build-linux:
runs-on: ubuntu-latest
needs: prepare
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Create and activate virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
pip install -r requirements.txt
- name: Build binary
run: |
source venv/bin/activate
pyinstaller lang_detect.spec
- name: Copy config files
run: cp config.json dist/lang_detect/
- name: Zip the dist folder
run: cd dist/ && zip -r ../lang-detect_${{ needs.prepare.outputs.short_sha }}_linux-x86_64.zip lang_detect/ && cd ../
- name: Upload ZIP to FTP
run: |
curl -T lang-detect_${{ needs.prepare.outputs.short_sha }}_linux-x86_64.zip ftp://dev.linux.build.pdfix.net/public/builds/plug-ins/lang-detect/main/${{ needs.prepare.outputs.short_sha }}/ --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs
build-windows:
runs-on: windows-latest
needs: prepare
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Create and activate virtual environment
run: |
python -m venv venv
.\venv\Scripts\activate
- name: Install dependencies
run: |
.\venv\Scripts\activate
pip install -r requirements.txt
- name: Build binary
run: |
.\venv\Scripts\activate
pyinstaller lang_detect.spec
- name: Copy config files
run: cp config.json dist/lang_detect/
- name: Zip the dist folder
run: Compress-Archive -Path dist/* -DestinationPath lang-detect_${{ needs.prepare.outputs.short_sha }}_windows-x86_64.zip
- name: Upload ZIP to FTP
run: |
curl -T lang-detect_${{ needs.prepare.outputs.short_sha }}_windows-x86_64.zip ftp://dev.linux.build.pdfix.net/public/builds/plug-ins/lang-detect/main/${{ needs.prepare.outputs.short_sha }}/ --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs
build-macos-arm64:
runs-on: macos-14
needs: prepare
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Create and activate virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
pip install -r requirements.txt
- name: Build ARM64 binary
run: |
source venv/bin/activate
pyinstaller lang_detect.spec
- name: Copy config files
run: cp config.json dist/lang_detect/
- name: Zip the dist folder
run: cd dist/ && zip -r ../lang-detect_${{ needs.prepare.outputs.short_sha }}_macos-arm64.zip lang_detect/ && cd ../
- name: Upload ZIP to FTP
shell: bash
run: |
curl -T lang-detect_${{ needs.prepare.outputs.short_sha }}_macos-arm64.zip ftp://dev.linux.build.pdfix.net/public/builds/plug-ins/lang-detect/main/${{ needs.prepare.outputs.short_sha }}/ --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs
build-macos-x86_64:
runs-on: macos-latest
needs: prepare
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Create and activate virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
pip install -r requirements.txt
- name: Build x86_64 binary
run: |
source venv/bin/activate
pyinstaller lang_detect.spec
- name: Copy config files
run: cp config.json dist/lang_detect/
- name: Zip the dist folder
run: cd dist/ && zip -r ../lang-detect_${{ needs.prepare.outputs.short_sha }}_macos-x86_64.zip lang_detect/ && cd ../
- name: Upload ZIP to FTP
run: |
curl -T lang-detect_${{ needs.prepare.outputs.short_sha }}_macos-x86_64.zip ftp://dev.linux.build.pdfix.net/public/builds/plug-ins/lang-detect/main/${{ needs.prepare.outputs.short_sha }}/ --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs