-
Notifications
You must be signed in to change notification settings - Fork 4
135 lines (116 loc) · 4.98 KB
/
Copy pathmain.yml
File metadata and controls
135 lines (116 loc) · 4.98 KB
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: XPSystem CI
on:
push:
branches:
- master
- release
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
EXILED_REFERENCES_URL: https://exslmod-team.github.io/SL-References/Dev.zip
EXILED_REFERENCES: ${{ github.workspace }}/refs
jobs:
main:
runs-on: windows-latest
steps:
- name: setup-msbuild
uses: microsoft/[email protected]
with:
# Folder location of where vswhere.exe is located if a self-hosted agent
# vswhere-path: # optional
# Version of Visual Studio to search; defaults to latest if not specified
# vs-version: # optional
# Enable searching for pre-release versions of Visual Studio/MSBuild
vs-prerelease: false # optional
# The preferred processor architecture of MSBuild. Can be either "x86" or "x64". "x64" is only available from Visual Studio version 17.0 and later.
msbuild-architecture: x64
- name: Setup NuGet
uses: NuGet/[email protected]
- uses: actions/[email protected]
- name: Get sl references
shell: pwsh
run: |
Invoke-WebRequest -Uri ${{ env.EXILED_REFERENCES_URL }} -OutFile ${{ github.workspace }}/References.zip
Expand-Archive -Path References.zip -DestinationPath ${{ env.EXILED_REFERENCES }} -Force
- name: Restore Packages
run: nuget restore ${{ github.workspace }}/XPSystem.sln
- name: Build nwapi
shell: pwsh
run: |
msbuild.exe ${{ github.workspace }}/XPSystem.sln /p:Configuration="Release" /p:Platform="Any CPU"
- name: Build nwapi bundled
shell: pwsh
run: |
msbuild.exe ${{ github.workspace }}/XPSystem.sln /p:Configuration="Release Bundled" /p:Platform="Any CPU"
- name: Build exiled
shell: pwsh
run: |
msbuild.exe ${{ github.workspace }}/XPSystem.sln /p:Configuration="Release EXILED" /p:Platform="Any CPU"
- name: Run
shell: pwsh
run: |
$output = & "${{ github.workspace }}/XPSystem.Console/bin/Release/XPSystem.Console.exe" | Out-String
$output = $output.TrimEnd()
$ver = $output.Split([Environment]::NewLine)[-1]
echo $output
echo "Last line (should be version): $($ver)"
echo "currver=$ver" >> $env:GITHUB_ENV
- name: Copy files
shell: pwsh
run: |
New-Item -Path '${{ github.workspace }}/bin' -Type Directory
Copy-Item -Path '${{ github.workspace }}/XPSystem/bin/Release/XPSystem.dll' -Destination '${{ github.workspace }}/bin/XPSystem-nw.dll'
Copy-Item -Path '${{ github.workspace }}/XPSystem/bin/Release Bundled/XPSystem.dll' -Destination '${{ github.workspace }}/bin/XPSystem-nw-bundled.dll'
Copy-Item -Path '${{ github.workspace }}/XPSystem/bin/Release EXILED/XPSystem.dll' -Destination '${{ github.workspace }}/bin/XPSystem-EXILED.dll'
- name: Get branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: get_branch
- name: Fetch origin
run: |
git fetch origin ${{ steps.get_branch.outputs.branch }}
- name: Get release logic
run: |
if ("${{ steps.get_branch.outputs.branch }}" -eq "master")
{
echo "release_exludes=''" >> $env:GITHUB_ENV
}
else
{
echo "release_exludes=prerelease" >> $env:GITHUB_ENV
}
- name: Get latest release
id: latestrelease
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
excludes: ${{ env.release_exludes }}
- name: Compare versions
shell: pwsh
run: |
$releasever = "${{ steps.latestrelease.outputs.release }}"
$releasever = $releasever.replace('v', '')
if ($([System.Version]"${{ env.currver }}" -gt [System.Version]$releasever))
{
echo "newversion=true" >> $env:GITHUB_ENV
}
- uses: ncipollo/[email protected]
if: ${{ env.newversion == 'true' || steps.get_branch.outputs.branch == 'master' }}
with:
artifacts: "${{ github.workspace }}/bin/*"
generateReleaseNotes: true
allowUpdates: true
removeArtifacts: true
prerelease: ${{ steps.get_branch.outputs.branch == 'master' }}
makeLatest: ${{ steps.get_branch.outputs.branch == 'release' }}
token: ${{ secrets.GITHUB_TOKEN }}
commit: ${{ steps.get_branch.outputs.branch }}
tag: "${{ env.currver }}"
- name: Create release pr
if: ${{ env.newversion == 'true' && steps.get_branch.outputs.branch == 'master' }}
shell: bash
run: gh pr create -B release -H master --title '${{ env.currver }}' --body 'Automated PR' || echo 'error'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}