This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
177 lines (157 loc) · 9.13 KB
/
publish_release.yaml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Publish Release
on:
workflow_dispatch:
inputs:
tag:
required: true
description: tag is going to be released
is-pre:
required: true
description: pre-release
type: boolean
ll-ver:
required: true
description: liteloader version
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .
# 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
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/[email protected]
with:
submodules: true
fetch-depth: 0
# - name: Get information from Version.h file (TODO)
# working-directory: ${{env.GITHUB_WORKSPACE}}
# id: ver
# run: |
# pwd
- name: Download Server
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
New-Item -Path ".\SDK\tools\Server" -ItemType Directory
Get-Content -Path ".\scripts\LINK.txt" | Set-Variable -Name ServerLink
Start-BitsTransfer -Source $ServerLink -Destination ".\SDK\tools\Server\server.zip"
Expand-Archive -Path ".\SDK\tools\Server\server.zip" -DestinationPath ".\SDK\tools\Server"
- name: Build Library
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
Set-Location -Path ".\SDK\tools"
.\PeEditor.exe -l --pdb ".\Server\bedrock_server.pdb" -o "..\lib"
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Build
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 /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} ${{ env.SOLUTION_FILE_PATH }}
- name: Copy dll and pdb files
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
New-Item -Path ".\output" -ItemType Directory
New-Item -Path ".\output\RELEASE" -ItemType Directory
New-Item -Path ".\output\RELEASE\LiteLoader" -ItemType Directory
New-Item -Path ".\output\RELEASE\lib" -ItemType Directory
Copy-Item -Path ".\x64\Release\Ijwhost.dll" -Destination ".\output\RELEASE\lib\Ijwhost.dll" -Force
Copy-Item -Path ".\x64\Release\LiteLoader.NET.dll" -Destination ".\output\RELEASE\LiteLoader\LiteLoader.NET.dll" -Force
Copy-Item -Path ".\x64\Release\LiteLoader.NET.runtimeconfig.json" -Destination ".\output\RELEASE\LiteLoader\LiteLoader.NET.runtimeconfig.json" -Force
New-Item -Path ".\output\PDB" -ItemType Directory
Copy-Item -Path ".\x64\Release\*.pdb" -Destination ".\output\PDB" -Force
# mkdir output/${{ env.PLUGIN_NAME }}/${{ env.PLUGIN_NAME }}/
# cp -r Data/* output/${{ env.PLUGIN_NAME }}/${{ env.PLUGIN_NAME }}/
- name: Pack Release
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
Compress-Archive -Path ".\output\RELEASE\*" -DestinationPath ".\LiteLoader.NET.zip"
Compress-Archive -Path ".\output\PDB\*" -DestinationPath ".\PDB.zip"
- name: Create tooth pack info
run: |
"{" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"format_version`": 1," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"tooth`": `"github.com/Tooth-Hub/LLDotNET`"," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"version`": `"${{ github.event.inputs.tag }}`"," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"dependencies`": {" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"github.com/Tooth-Hub/LiteLoaderBDS`": [" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" [" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"${{ github.event.inputs.ll-ver }}`"" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" ]" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" ]" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" }," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"information`": {" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"name`": `"LiteLoader.NET`"," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"description`": `"LiteLoader bindings for .NET (WIP)`"," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"author`": `"LiteLoader.NET Developers`"," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"license`": `"LGPL 3.0`"," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"homepage`": `"https://github.com/LiteLDev/LiteLoader.NET`"" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" }," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"placement`": [" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" {" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"source`": `"LiteLoader/LiteLoader.NET.dll`"," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"destination`": `"plugins/LiteLoader/LiteLoader.NET.dll`"" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" }," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" {" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"source`": `"LiteLoader/LiteLoader.NET.runtimeconfig.json`"," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"destination`": `"plugins/LiteLoader/LiteLoader.NET.runtimeconfig.json`"" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" }," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" {" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"source`": `"lib/Ijwhost.dll`"," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"destination`": `"plugins/lib/Ijwhost.dll`"" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" }" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" ]," | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
" `"possession`": []" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
"}" | Out-File -FilePath ".\output\RELEASE\tooth.json" -Append
- name: Pack tooth pack
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
Compress-Archive -Path ".\output\RELEASE\*" -DestinationPath ".\LiteLoader.NET.tth"
- name: Prepare for creating Release
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
Rename-Item -Path "LiteLoader.NET.zip" -NewName "LiteLoader.NET-${{ github.event.inputs.tag }}.zip"
Rename-Item -Path "LiteLoader.NET.tth" -NewName "LiteLoader.NET-${{ github.event.inputs.tag }}.tth"
Rename-Item -Path "PDB.zip" -NewName "PDB-${{ github.event.inputs.tag }}.zip"
- name: Config git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Create tag and update branch
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
git rev-parse --abbrev-ref HEAD | Set-Variable -Name LLNET_NOW_BRANCH
git log -n1 --format=format:"%H" | Set-Variable -Name LLNET_NOW_HASH
git tag ${{ github.event.inputs.tag }}
git push --tags origin ${{ github.event.inputs.tag }}
- name: Create New Release
uses: ncipollo/[email protected]
env:
GITHUB_REPOSITORY: ${{ env.GITHUB_ACTION_REPOSITORY }}
with:
prerelease: ${{ inputs.is-pre }}
tag: ${{ github.event.inputs.tag }}
# bodyFile: ${{ github.workspace }}\CHANGELOG.md
artifacts: |
${{ github.workspace }}\LiteLoader.NET-${{ github.event.inputs.tag }}.zip
${{ github.workspace }}\LiteLoader.NET-${{ github.event.inputs.tag }}.tth
${{ github.workspace }}\PDB-${{ github.event.inputs.tag }}.zip
- name: Update SDK
working-directory: ${{ env.GITHUB_WORKSPACE }}
env:
REPO_KEY: ${{ secrets.PUSH_TOKEN }}
USERNAME: github-actions[bot]
run: |
Set-Location -Path "scripts"
.\UploadSDK.ps1 release
- name: Update tooth package
working-directory: ${{ env.GITHUB_WORKSPACE }}
env:
REPO_KEY: ${{ secrets.PUSH_TOKEN }}
USERNAME: github-actions[bot]
run: |
Set-Location -Path "scripts"
.\UploadToothPackage.ps1