generated from LiteLDev/liteloaderbds-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 7
113 lines (94 loc) · 4.13 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
name: Build BEPlaceholderAPI
on: [push, workflow_dispatch]
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: ./BEPlaceholderAPI.sln
# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release
Platform: X64
VERSION_FILE_PATH: ./BEPlaceholderAPI/Version.h
jobs:
pre-process:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: Download Server
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
mkdir D:/BDS
curl -L -o D:/BDS/LINK.txt "https://raw.githubusercontent.com/LiteLDev/LiteLoaderBDS/develop/scripts/LINK.txt"
ServerLink=$(cat 'D:/BDS/LINK.txt')
curl -L -o D:/BDS/server.zip "$ServerLink"
unzip D:/BDS/server.zip -d D:/BDS > /dev/null
shell: bash
- name: Build Library
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
cd SDK/tools
PeEditor.exe -l --pdb D:/BDS/bedrock_server.pdb -o ../lib
shell: cmd
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
# - name: Restore NuGet packages
# working-directory: ${{env.GITHUB_WORKSPACE}}
# run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: Change PLUGIN_VERSION_STATUS_BETA
working-directory: ${{env.GITHUB_WORKSPACE}}
if: false == startsWith(github.ref, 'refs/tags/')
run: |
sed -r -i 's/#define\s+PLUGIN_VERSION_STATUS\s+PLUGIN_VERSION_\w+/#define PLUGIN_VERSION_STATUS PLUGIN_VERSION_BETA/' ${{env.VERSION_FILE_PATH}}
sed -r -i 's/#define\s+PLUGIN_VERSION_BUILD\s+.*/#define PLUGIN_VERSION_BUILD ${{ github.run_number }}\r/' ${{env.VERSION_FILE_PATH}}
shell: bash
- name: Change PLUGIN_VERSION_STATUS_RELEASE
working-directory: ${{env.GITHUB_WORKSPACE}}
if: startsWith(github.ref, 'refs/tags/')
run: |
sed -r -i 's/#define\s+PLUGIN_VERSION_STATUS\s+PLUGIN_VERSION_\w+/#define PLUGIN_VERSION_STATUS PLUGIN_VERSION_RELEASE/' ${{env.VERSION_FILE_PATH}}
sed -r -i 's/#define\s+PLUGIN_VERSION_BUILD\s+.*/#define PLUGIN_VERSION_BUILD ${{ github.run_number }}\r/' ${{env.VERSION_FILE_PATH}}
shell: bash
- name: Build Plugin
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: |
MSBuild.exe ${{env.SOLUTION_FILE_PATH}} -property:Configuration=${{env.BUILD_CONFIGURATION}}
shell: bash
- name: copy dll and pdb files
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
mkdir output
mkdir output/plugins
cp -f x64/Release/*.dll output/plugins
mkdir output/plugins/lib/
cp -f x64/Release/*.pdb output/plugins/lib
cp -f Lib/*.* output/plugins/Lib
shell: bash
- name: upload files
uses: actions/upload-artifact@v2
with:
name: BEPlaceholderAPI
path: ${{ github.workspace }}/output/
- name: Archive
working-directory: ${{env.GITHUB_WORKSPACE}}
if: startsWith(github.ref, 'refs/tags/')
run: Compress-Archive -Path output/* output/BEPlaceholderAPI.zip
- name: Prepare for creating Release
working-directory: ${{env.GITHUB_WORKSPACE}}
id: rel
if: startsWith(github.ref, 'refs/tags/')
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/tags/*}
mv output/BEPlaceholderAPI.zip output/BEPlaceholderAPI-${GITHUB_REF#refs/tags/*}.zip
shell: bash
- name: Create New Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
# body_path: ${{ github.workspace }}/CHANGELOG.txt
files: ${{ github.workspace }}\output\BEPlaceholderAPI-${{ steps.rel.outputs.tag }}.zip
env:
GITHUB_REPOSITORY: LiteLDev/BEPlaceholderAPI