-
Notifications
You must be signed in to change notification settings - Fork 167
101 lines (88 loc) · 4.41 KB
/
main.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
name: Build and publish PHP binaries
on:
push:
branches: "**"
tags-ignore: "php-**"
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
all-builds:
name: PM${{ matrix.pm-version-major }}
strategy:
matrix:
pm-version-major: [4, 5]
uses: ./.github/workflows/main-pm-matrix.yml
with:
pm-version-major: ${{ matrix.pm-version-major }}
secrets: inherit
publish:
name: Publish binaries
needs: [all-builds]
runs-on: ubuntu-20.04
if: ${{ startsWith(github.ref_name, 'php/') && github.ref_type == 'branch' && !contains(github.event.head_commit.message, '[no release]') }}
steps:
- uses: actions/checkout@v4
- name: Set version information
id: version
run: |
echo PHP_VERSION=$(echo ${{ github.ref_name }} | cut -d / -f2) >> $GITHUB_OUTPUT
- name: Update latest tag target
run: |
git tag -f php-${{ steps.version.outputs.PHP_VERSION }}-latest
git push -f origin php-${{ steps.version.outputs.PHP_VERSION }}-latest
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}
- name: Generate release notes
run: |
echo "Last updated on **$(date -u +'%Y-%m-%d at %H:%M:%S %Z')**" > changelog.md
echo -e "\n\n" >> changelog.md
echo "Built by: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> changelog.md
if [[ "${{ github.ref_name }}" != "${{ github.event.repository.default_branch }}" ]]; then
echo -e "\n\n\n" >> changelog.md
if [[ "${{ github.ref_name }}" == *"preview" ]]; then
echo "# :warning: :radioactive: EXPERIMENTAL!!! :radioactive: :warning:" >> changelog.md
echo "### Your server and/or plugins may crash or misbehave with this release!" >> changelog.md
echo "### Consider downloading the [recommended release](${{ github.server_url }}/${{ github.repository }}/releases/latest) instead." >> changelog.md
else
echo ":warning: WARNING! :warning:" >> changelog.md
echo "Some plugins might not work properly on this version yet." >> changelog.md
echo "If you have problems, try the [recommended release](${{ github.server_url }}/${{ github.repository }}/releases/latest) instead." >> changelog.md
fi
else
echo ":white_check_mark: This version is recommended for production servers." >> changelog.md
fi
echo -e "\n\n\n" >> changelog.md
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
- name: Update latest branch release
uses: ncipollo/[email protected]
with:
artifacts: |
${{ github.workspace }}/Linux-PM*/*.tar.gz
${{ github.workspace }}/MacOS-*-PM*/*.tar.gz
${{ github.workspace }}/Windows-PM*/*.zip
makeLatest: ${{ github.ref_name == github.event.repository.default_branch }}
name: PHP ${{ steps.version.outputs.PHP_VERSION }} - Latest (Build ${{ github.run_number }})
tag: php-${{ steps.version.outputs.PHP_VERSION }}-latest
commit: ${{ github.sha }}
allowUpdates: true
bodyFile: ${{ github.workspace }}/changelog.md
removeArtifacts: true
prerelease: ${{ endsWith(github.ref_name, '-preview') }}
- name: Publish unique release
uses: ncipollo/[email protected]
with:
artifacts: |
${{ github.workspace }}/Linux-PM*/*.tar.gz
${{ github.workspace }}/MacOS-*-PM*/*.tar.gz
${{ github.workspace }}/Windows-PM*/*.zip
makeLatest: false
name: PHP ${{ steps.version.outputs.PHP_VERSION }} (Build ${{ github.run_number }})
tag: php-${{ steps.version.outputs.PHP_VERSION }}-build-${{ github.run_number }}
commit: ${{ github.sha }}
bodyFile: ${{ github.workspace }}/changelog.md
prerelease: ${{ endsWith(github.ref_name, '-preview') }}