77 description : ' PocketMine-MP major version'
88 required : true
99 type : number
10+ php-version-base :
11+ description : ' PHP base version'
12+ required : true
13+ type : string
14+ special-release :
15+ description : ' Special release type to create (pm-default-latest, pm-default, none)'
16+ required : true
17+ type : string
18+ pm-preview :
19+ description : " Mark releases as pre-release"
20+ required : true
21+ type : boolean
22+
23+ env :
24+ MUSL_CROSS_MAKE_VERSION : 7b9487e56efc83c419a397af7df7f119001dc51c
1025
1126jobs :
27+ android :
28+ name : Android arm64
29+ runs-on : ubuntu-20.04
30+
31+ steps :
32+ - uses : actions/checkout@v4
33+
34+ - name : Install tools and dependencies
35+ run : |
36+ sudo apt-get update
37+ sudo apt-get install make autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c
38+
39+ - name : Prepare compile.sh download cache
40+ id : download-cache
41+ uses : actions/cache@v4
42+ with :
43+ path : ./download_cache
44+ key : compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }}
45+ restore-keys : compile-sh-cache-ssl-https-
46+
47+ - name : Fetch compiler cache
48+ id : compiler-cache
49+ uses : actions/cache@v4
50+ with :
51+ path : ${{ github.workspace }}/compiler
52+ key : musl-cross-make-${{ env.MUSL_CROSS_MAKE_VERSION }}
53+ restore-keys : musl-cross-make-
54+
55+ - name : Checkout musl-cross-make
56+ uses : actions/checkout@v4
57+ with :
58+ repository : pmmp/musl-cross-make
59+ path : musl-cross-make
60+ ref : ${{ env.MUSL_CROSS_MAKE_VERSION }}
61+
62+ - name : Build compiler
63+ working-directory : musl-cross-make
64+ run : |
65+ echo "TARGET = aarch64-linux-musl" > config.mak
66+ make -j$(nproc)
67+ make install
68+ mv ./output "${{ github.workspace }}/compiler"
69+
70+ - name : Compile PHP
71+ run : |
72+ export PATH="${{ github.workspace }}/compiler/bin:$PATH"
73+
74+ # Used "set -ex" instead of hashbang since script isn't executed with hashbang
75+ set -ex
76+ trap "exit 1" ERR
77+ ./compile.sh -t android-aarch64 -x -j 4 -g -F -P ${{ inputs.pm-version-major }} -c ./download_cache -D -z ${{ inputs.php-version-base }}
78+
79+
80+ - name : Create tarball
81+ run : |
82+ tar -czf ./PHP-${{ inputs.php-version-base }}-Android-arm64-PM${{ inputs.pm-version-major }}.tar.gz bin
83+ tar -czf ./PHP-${{ inputs.php-version-base }}-Android-arm64-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
84+
85+ - name : Upload artifacts
86+ uses : actions/upload-artifact@v4
87+ if : always()
88+ with :
89+ name : PHP-${{ inputs.php-version-base }}-Android-PM${{ inputs.pm-version-major }}
90+ path : |
91+ ./PHP-${{ inputs.php-version-base }}-Android-arm64-PM${{ inputs.pm-version-major }}*.tar.gz
92+ install.log
93+ compile.sh
94+ if-no-files-found : error
95+
96+ - name : Prepare workspace for upload
97+ if : failure()
98+ run : tar -czf workspace.tar.gz install_data
99+
100+ - name : Upload workspace
101+ uses : actions/upload-artifact@v4
102+ if : failure()
103+ with :
104+ name : PHP-${{ inputs.php-version-base }}-Android-workspace-PM${{ inputs.pm-version-major }}
105+ path : |
106+ workspace.tar.gz
107+ if-no-files-found : error
108+
12109 linux :
13110 name : Linux
14111 runs-on : ubuntu-20.04
@@ -34,20 +131,20 @@ jobs:
34131 # Used "set -ex" instead of hashbang since script isn't executed with hashbang
35132 set -ex
36133 trap "exit 1" ERR
37- ./compile.sh -t linux64 -j 4 -g -F -P ${{ inputs.pm-version-major }} -c ./download_cache -D
134+ ./compile.sh -t linux64 -j 4 -g -F -P ${{ inputs.pm-version-major }} -c ./download_cache -D -z ${{ inputs.php-version-base }}
38135
39136 - name : Create tarball
40137 run : |
41- tar -czf ./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}.tar.gz bin
42- tar -czf ./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
138+ tar -czf ./PHP-${{ inputs.php-version-base }}- Linux-x86_64-PM${{ inputs.pm-version-major }}.tar.gz bin
139+ tar -czf ./PHP-${{ inputs.php-version-base }}- Linux-x86_64-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
43140
44141 - name : Upload artifacts
45142 uses : actions/upload-artifact@v4
46143 if : always()
47144 with :
48- name : Linux-PM${{ inputs.pm-version-major }}
145+ name : PHP-${{ inputs.php-version-base }}- Linux-PM${{ inputs.pm-version-major }}
49146 path : |
50- ./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}*.tar.gz
147+ ./PHP-${{ inputs.php-version-base }}- Linux-x86_64-PM${{ inputs.pm-version-major }}*.tar.gz
51148 install.log
52149 compile.sh
53150 if-no-files-found : error
60157 uses : actions/upload-artifact@v4
61158 if : failure()
62159 with :
63- name : Linux-workspace-PM${{ inputs.pm-version-major }}
160+ name : PHP-${{ inputs.php-version-base }}- Linux-workspace-PM${{ inputs.pm-version-major }}
64161 path : |
65162 workspace.tar.gz
66163 if-no-files-found : error
73170 include :
74171 - target-name : mac-x86-64
75172 artifact-name : x86_64
76- image : macos-12
173+ image : macos-13
77174 - target-name : mac-arm64
78175 artifact-name : arm64
79176 image : macos-14
@@ -82,8 +179,11 @@ jobs:
82179 - uses : actions/checkout@v4
83180
84181 - name : Install tools and dependencies
85- run : brew install libtool autoconf automake pkg-config bison re2c
86-
182+ run : |
183+ #workaround github actions default image providing outdated pkg-config
184+ brew uninstall --ignore-dependencies --force [email protected] || true 185+ brew install libtool autoconf automake pkg-config bison re2c
186+
87187 - name : Prepare compile.sh download cache
88188 id : download-cache
89189 uses : actions/cache@v4
@@ -97,20 +197,20 @@ jobs:
97197 export PATH="/usr/local/opt/bison/bin:$PATH"
98198 set -ex
99199 trap "exit 1" ERR
100- ./compile.sh -t ${{ matrix.target-name }} -j4 -g -F -P ${{ inputs.pm-version-major }} -c ./download_cache -D
200+ ./compile.sh -t ${{ matrix.target-name }} -j4 -g -F -P ${{ inputs.pm-version-major }} -c ./download_cache -D -z ${{ inputs.php-version-base }}
101201
102202 - name : Create tarball
103203 run : |
104- tar -czf ./PHP-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}.tar.gz bin
105- tar -czf ./PHP-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
204+ tar -czf ./PHP-${{ inputs.php-version-base }}- MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}.tar.gz bin
205+ tar -czf ./PHP-${{ inputs.php-version-base }}- MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
106206
107207 - name : Upload artifacts
108208 uses : actions/upload-artifact@v4
109209 if : always()
110210 with :
111- name : MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}
211+ name : PHP-${{ inputs.php-version-base }}- MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}
112212 path : |
113- ./PHP-MacOS-${{ matrix.artifact-name}}-PM${{ inputs.pm-version-major }}*.tar.gz
213+ ./PHP-${{ inputs.php-version-base }}- MacOS-${{ matrix.artifact-name}}-PM${{ inputs.pm-version-major }}*.tar.gz
114214 install.log
115215 compile.sh
116216 if-no-files-found : error
@@ -123,7 +223,7 @@ jobs:
123223 uses : actions/upload-artifact@v4
124224 if : failure()
125225 with :
126- name : MacOS-${{ matrix.artifact-name }}-workspace-PM${{ inputs.pm-version-major }}
226+ name : PHP-${{ inputs.php-version-base }}- MacOS-${{ matrix.artifact-name }}-workspace-PM${{ inputs.pm-version-major }}
127227 path : |
128228 workspace.tar.gz
129229 if-no-files-found : error
@@ -134,31 +234,117 @@ jobs:
134234
135235 steps :
136236 - uses : actions/checkout@v4
137-
138- - name : Install tools and dependencies
139- run : choco install wget --no-progress
140-
237+
238+ - name : Prepare download cache
239+ id : download-cache
240+ uses : actions/cache@v4
241+ with :
242+ path : ./download_cache
243+ key : windows-cache-${{ hashFiles('./windows-compile-vs.ps1') }}
244+ restore-keys : windows-cache-
245+
141246 - name : Compile PHP
142- run : .\windows-compile-vs.bat
247+ run : .\windows-compile-vs.ps1
143248 env :
144- VS_EDITION : Enterprise
145249 SOURCES_PATH : ${{ github.workspace }}\pocketmine-php-sdk
146250 PM_VERSION_MAJOR : ${{ inputs.pm-version-major }}
251+ PHP_VERSION_BASE : ${{ inputs.php-version-base }}
147252
148- - name : Rename artifacts
253+ - name : Prepare artifacts
149254 run : |
150255 mkdir temp
151- move php-debug-pack-*.zip temp/PHP -Windows-x64-PM${{ inputs.pm-version-major }}-debugging-symbols .zip
152- move php-*.zip temp/PHP-Windows-x64-PM${{ inputs.pm-version-major }}.zip
256+ Compress-Archive -Path .\bin -DestinationPath "PHP-${{ inputs.php-version-base }} -Windows-x64-PM${{ inputs.pm-version-major }}.zip"
257+ move php-debug-pack- *.zip temp/PHP-${{ inputs.php-version-base }}- Windows-x64-PM${{ inputs.pm-version-major }}-debugging-symbols .zip
153258 move temp\*.zip .
154259
155260 - name : Upload artifacts
156261 uses : actions/upload-artifact@v4
157262 if : always()
158263 with :
159- name : Windows-PM${{ inputs.pm-version-major }}
264+ name : PHP-${{ inputs.php-version-base }}- Windows-PM${{ inputs.pm-version-major }}
160265 path : |
161- PHP-Windows-x64*.zip
266+ PHP-${{ inputs.php-version-base }}- Windows-x64-PM${{ inputs.pm-version-major }} *.zip
162267 compile.log
163268 windows-compile-vs.bat
164269 if-no-files-found : error
270+
271+
272+ publish :
273+ name : Publish binaries
274+ needs : [linux, macos, windows, android]
275+ runs-on : ubuntu-20.04
276+ if : ${{ github.ref_name == 'stable' && github.ref_type == 'branch' && !contains(github.event.head_commit.message, '[no release]') }}
277+ concurrency : release-${{ inputs.php-version-base }}-pm${{ inputs.pm-version-major }}
278+
279+ steps :
280+ - uses : actions/checkout@v4
281+
282+ - name : Update latest tag target
283+ run : |
284+ git tag -f pm${{ inputs.pm-version-major }}-php-${{ inputs.php-version-base }}-latest
285+ git push -f origin pm${{ inputs.pm-version-major }}-php-${{ inputs.php-version-base }}-latest
286+ git tag -f pm${{ inputs.pm-version-major }}-latest
287+ git push -f origin pm${{ inputs.pm-version-major }}-latest
288+
289+ - name : Download artifacts
290+ uses : actions/download-artifact@v4
291+ with :
292+ path : ${{ github.workspace }}
293+ pattern : " PHP-${{ inputs.php-version-base }}-*-PM${{ inputs.pm-version-major }}"
294+
295+ - name : Generate release notes
296+ run : |
297+ echo "### PHP ${{ inputs.php-version-base }} for PocketMine-MP ${{ inputs.pm-version-major }}.x" > changelog.md
298+ echo "Last updated on **$(date -u +'%d %b %Y at %H:%M:%S %Z')**" >> changelog.md
299+ echo -e "\n\n" >> changelog.md
300+ echo "Built by: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> changelog.md
301+ echo "Build number: ${{ github.run_number }}" >> changelog.md
302+ echo -e "\n\n\n" >> changelog.md
303+ echo ":information_source: **Linux/MacOS users**: Please see [this page](https://doc.pmmp.io/en/rtfd/faq/installation/opcache.so.html) to fix extension loading errors. Also, check out the [PocketMine-MP Linux/MacOS installer](https://doc.pmmp.io/en/rtfd/installation/get-dot-pmmp-dot-io.html)." >> changelog.md
304+ echo ":warning: **Windows users**: Don't forget to install [Visual C++ Redistributable](https://aka.ms/vs/17/release/vc_redist.x64.exe) or the binary will not work!" >> changelog.md
305+ echo -e "\n\n\n" >> changelog.md
306+
307+ if [[ "${{ inputs.special-release }}" != "none" ]]; then
308+ echo ":white_check_mark: At the time of publication, this version is recommended for PocketMine-MP ${{ inputs.pm-version-major }}.x production servers." >> changelog.md
309+ else
310+ echo ":warning: WARNING! :warning:" >> changelog.md
311+ echo "At the time of publication, plugins for PocketMine-MP ${{ inputs.pm-version-major }}.x may not work this PHP version." >> changelog.md
312+ echo "If you have problems, try the [recommended PM${{ inputs.pm-version-major }} release](${{ github.server_url }}/${{ github.repository }}/releases/pm${{ inputs.pm-version-major }}-latest) instead." >> changelog.md
313+ fi
314+
315+ - name : Get date
316+ id : date
317+ run : |
318+ echo DATE=$(date -u +'%d %b %Y') >> $GITHUB_OUTPUT
319+
320+ - name : Update recommended PM release
321+ 322+ if : ${{ inputs.special-release != 'none' }}
323+ with :
324+ artifacts : |
325+ ${{ github.workspace }}/PHP-*-PM*/*.tar.gz
326+ ${{ github.workspace }}/PHP-*-Windows-PM*/*.zip
327+ name : PM ${{ inputs.pm-version-major }}.x (${{ steps.date.outputs.DATE }}) - Recommended
328+ tag : pm${{ inputs.pm-version-major }}-latest
329+ commit : ${{ github.sha }}
330+ allowUpdates : true
331+ removeArtifacts : true
332+ bodyFile : ${{ github.workspace }}/changelog.md
333+ makeLatest : ${{ inputs.special-release == 'default-latest' }}
334+ prerelease : ${{ inputs.pm-preview == 'true' }}
335+
336+ - name : Update php-version PM release
337+ 338+ with :
339+ artifacts : |
340+ ${{ github.workspace }}/PHP-*-PM*/*.tar.gz
341+ ${{ github.workspace }}/PHP-*-Windows-PM*/*.zip
342+ name : PM ${{ inputs.pm-version-major }}.x (${{ steps.date.outputs.DATE }}) - PHP ${{ inputs.php-version-base }}
343+ tag : pm${{ inputs.pm-version-major }}-php-${{ inputs.php-version-base }}-latest
344+ commit : ${{ github.sha }}
345+ allowUpdates : true
346+ removeArtifacts : true
347+ bodyFile : ${{ github.workspace }}/changelog.md
348+ makeLatest : false
349+ prerelease : ${{ inputs.pm-preview == 'true' }}
350+
0 commit comments