-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (151 loc) · 6.22 KB
/
build-w7.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Build latest for Windows 7
run-name: Check latest TorrServer release and build with go1.21.4 for Windows 7 🚀
permissions:
contents: write
on:
schedule:
# Every day at 15:30 UTC
- cron: 30 15 * * *
workflow_dispatch:
env:
TS_REPO_NAME: ${{ vars.REPO_VAR__SOURCE_REPO }}
W7_REPO_NAME: ${{ github.repository }}
jobs:
check_build_needed:
name: "Check if new build needed"
runs-on: ubuntu-latest
steps:
- name: Get latest ${{ env.TS_REPO_NAME }} release tag
id: get_ts_release_tag
run: |
echo "ts_release_tag=$(curl -s https://api.github.com/repos/$TS_REPO_NAME/releases/latest | jq '.tag_name' | sed 's/\"//g')" >> "$GITHUB_ENV"
- name: Get latest ${{ env.W7_REPO_NAME }} release tag
run: echo "w7_release_tag=$(curl -s https://api.github.com/repos/$W7_REPO_NAME/releases/latest | jq '.tag_name' | sed 's/\"//g')" >> "$GITHUB_ENV"
- name: Decide that there is a need to compile a new release
run: |
echo "is_needed_build=${{ ((env.w7_release_tag == '') || (env.w7_release_tag == 'null') || (env.w7_release_tag != env.ts_release_tag)) && 'TRUE' || 'FALSE' }}" >> "$GITHUB_ENV"
- name: Export variables
id: export_vars
run: |
echo "is_needed_build=$is_needed_build" >> "$GITHUB_OUTPUT"
echo "ts_release_tag=$ts_release_tag" >> "$GITHUB_OUTPUT"
echo "w7_release_tag=$w7_release_tag" >> "$GITHUB_OUTPUT"
echo "ts_repo_name: $TS_REPO_NAME"
echo "w7_repo_name: $W7_REPO_NAME"
echo "Need build: $is_needed_build"
echo "TS release tag: $ts_release_tag"
echo "W7 release tag: $w7_release_tag"
outputs:
is_needed_build: ${{ steps.export_vars.outputs.is_needed_build }}
ts_release_tag: ${{ steps.export_vars.outputs.ts_release_tag }}
print_data_and_check:
name: "Print data"
needs: check_build_needed
runs-on: ubuntu-latest
env:
is_needed_build: ${{ needs.check_build_needed.outputs.is_needed_build }}
ts_release_tag: ${{ needs.check_build_needed.outputs.ts_release_tag }}
steps:
- name: Print data
run: |
echo "is_needed_build=$is_needed_build"
echo "ts_release_tag=$ts_release_tag"
- name: Fail on empty TS_RELEASE_TAG
if: ${{ env.ts_release_tag == '' }}
run: |
echo "::error ::TS_RELEASE_TAG ($ts_release_tag) is EMPTY"
exit 1
- name: Succeed on IS_NEED_BUILD is TRUE
if: ${{ env.is_needed_build != 'TRUE' }}"
run: |
echo "::notice ::IS_NEED_BUILD is TRUE"
outputs:
is_needed_build: ${{ env.is_needed_build }}
ts_release_tag: ${{ env.ts_release_tag }}
build_release:
name: "Build release"
needs: print_data_and_check
runs-on: ubuntu-latest
env:
is_needed_build: ${{ needs.print_data_and_check.outputs.is_needed_build }}
ts_release_tag: ${{ needs.print_data_and_check.outputs.ts_release_tag }}
if: ${{ needs.print_data_and_check.outputs.is_needed_build == 'TRUE'}}
steps:
- name: Check out latest release
uses: actions/checkout@v4
with:
repository: ${{ env.TS_REPO_NAME }}
ref: ${{ env.ts_release_tag }}
lfs: true
submodules: true
path: torrserver
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '18.19.0'
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.21.4'
- name: Install Yarn
run: |
npm install --global yarn
- name: Install modules
env:
npm_config_loglevel: silent
working-directory: ./torrserver/web
run: |
npm install
- name: Install swag
run: |
go install github.com/swaggo/swag/cmd/swag@latest
- name: Tidy
working-directory: ./torrserver/server
run: |
go mod tidy
- name: Run swag
working-directory: ./torrserver/server
run: |
$HOME/go/bin/swag init -g web/server.go --parseDependency --parseInternal
$HOME/go/bin/swag fmt
- name: Build web
env:
CI: false
run: |
NODE_OPTIONS=--openssl-legacy-provider yarn build
working-directory: ./torrserver/web
- name: Remove non-windows platforms
working-directory: ./torrserver
run: |
sed -i -r "/^\s+\x27(linux|darwin|freebsd)\/\S+\x27\s*$/d" ./build-all.sh
sed -i -r "/^\s+\x22\S+:\S+linux-android\S+\x22\s*$/d" ./build-all.sh
- name: Build TorrServer
working-directory: ./torrserver
run: |
chmod +x ./build-all.sh
./build-all.sh
- name: Create release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
name: ${{ env.ts_release_tag }} for Windows 7
tag_name: ${{ env.ts_release_tag }}
draft: false
prerelease: false
files: |
./torrserver/dist/*.exe
body: |
${{ env.ts_release_tag }} для Windows 7
Эта сборка выполнена автоматически и предоставляется AS-IS.
Скрипт сборки вы можете найти в репозитории.
Начиная с go1.21.5 приложения, собранные с его помощью, не запускаются в Windows 7.
Поддержка Windows 7 прекращена с go1.21.
С помощью go1.20 уже нельзя собрать TorrServer.
Таким образом, неизвестно, как долго получится поддерживать
сборку с помощью go1.21.4, последней совместимой с Windows 7.
This is automated daily build and provided AS-IS
fail_on_unmatched_files: true
generate_release_notes: false
- run: echo "Finished"