-
Notifications
You must be signed in to change notification settings - Fork 102
135 lines (130 loc) · 5.71 KB
/
create_release.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
name: Create Release
concurrency:
group: create_release
cancel-in-progress: true
on:
workflow_dispatch:
jobs:
get_release_info:
name: Get Release Info
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.release_info.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Release Info
id: release_info
run: |
version="2.2"
last_version_tag=$(git tag -l --sort=creatordate | grep -E '^([0-9]+\.){3}[0-9]+$' | tail -n1)
major_version=$(echo "$last_version_tag" | cut -d. -f1)
minor_version=$(echo "$last_version_tag" | cut -d. -f2)
patch_version=$(echo "$last_version_tag" | cut -d. -f3)
build_number=$(echo "$last_version_tag" | cut -d. -f4)
if [ "$major_version.$minor_version" != "$version" ];
then patch_version=0;
else patch_version=$((1+patch_version));
fi
new_version_tag="$version.$patch_version.$((1+build_number))"
echo $new_version_tag
echo "version=$new_version_tag" >> $GITHUB_OUTPUT
git log origin/master --first-parent --format="%s%n%w(0,4,4)%b" "$last_version_tag".. | grep -v "^$" >> patch_notes.txt
if [ ! -s patch_notes.txt ]; then echo "No commits since last run."; exit 1; fi #fail if empty
#Prepend patch notes with backticks
sed -i '1s/^/```\n/' patch_notes.txt
- name: Upload
uses: actions/upload-artifact@v4
with:
name: release_info
path: |
patch_notes.txt
netcore_build:
name: Create Build
needs: get_release_info
runs-on: ubuntu-22.04
strategy:
matrix:
build_target: [Debug, Release]
env:
OUTPUT_FILE_NAME: DOLServer_${{ matrix.build_target }}.zip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Setup MinGW-w64
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
- name: Build
run: |
export DOTNET_CLI_TELEMETRY_OPTOUT=1
assembly_version="${{ needs.get_release_info.outputs.version }}"
dotnet build --configuration "${{ matrix.build_target}}" -p:Version="$assembly_version" --verbosity normal "Dawn of Light.sln"
echo "dotnet DOLServer.dll" > "${{ matrix.build_target }}/DOLServer.bat"
- name: Build DOL Detour (Linux x64)
run: |
mkdir Pathing/Detour/build
cd Pathing/Detour/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..
make
cp libdol_detour.so ../../../${{ matrix.build_target }}/
- name: Build DOL Detour (Windows x64)
run: |
mkdir Pathing/Detour/build_win64
cd Pathing/Detour/build_win64
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++-posix -DCMAKE_SHARED_LINKER_FLAGS="-static" ..
make
cp libdol_detour.dll ../../../${{ matrix.build_target }}/dol_detour.dll
- name: Test Build
run: |
dotnet test --verbosity normal --filter "DOL.UnitTests" ./build/Tests/${{ matrix.build_target }}/lib/Tests.dll
dotnet test --verbosity normal --filter "DOL.Integration" ./build/Tests/${{ matrix.build_target }}/lib/Tests.dll
- name: Add DOLConfig
if: ${{ github.repository_owner == 'Dawn-of-Light' }}
run: |
dolconfig_location="$(dirname $(git remote get-url origin))/DOLConfig/releases/latest/download/DOLConfig_${{ matrix.build_target }}.zip"
wget "$dolconfig_location" -O DOLConfig.zip
unzip DOLConfig.zip -d "${{ matrix.build_target }}/config"
- name: Cleanup
run: |
# Move everything except DOLServer files into lib folder
find "${{ matrix.build_target }}" -maxdepth 1 -type f ! -name 'DOLServer*' -exec mv "{}" "${{ matrix.build_target }}/lib/" \;
mv "${{ matrix.build_target }}/runtimes" "${{ matrix.build_target }}/lib"
sed -bi "s/\"runtimes/\"lib\/runtimes/" "${{ matrix.build_target }}/DOLServer.deps.json"
# Remove SQLite native binaries for alpine, 32-bit, mips, s390x, wasm, maccatalyst
rm -rf "${{ matrix.build_target }}/lib/runtimes/"alpine*
rm -rf "${{ matrix.build_target }}/lib/runtimes/"*{arm,x86,armel}
rm -rf "${{ matrix.build_target }}/lib/runtimes/"{linux-mips64,linux-s390x,browser-wasm}
rm -rf "${{ matrix.build_target }}/lib/runtimes/"maccatalyst*
# Replace alpine with linux-musl
sed -bi "s/\/alpine/\/linux-musl/" "${{ matrix.build_target }}/DOLServer.deps.json"
- name: Compress Build Artifacts
run: |
(cd ${{ matrix.build_target }}/ && zip -r ../${{ env.OUTPUT_FILE_NAME }} * )
- name: Upload Build Output
uses: actions/upload-artifact@v4
with:
name: build_artifacts-${{ matrix.build_target }}
path: ${{ env.OUTPUT_FILE_NAME }}
create_release:
name: Create Release
needs: [get_release_info,netcore_build]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create Release
run: |
set -x
new_version_tag="${{ needs.get_release_info.outputs.version }}"
gh release create "$new_version_tag" --title "$new_version_tag" --notes-file release_info/patch_notes.txt build_artifacts-*/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}