Skip to content

sl 13.5

sl 13.5 #67

Workflow file for this run

name: XPSystem CI
on:
push:
branches:
- master
- release
env:
EXILED_REFERENCES_URL: https://misaka-zerotwo.github.io/SL-References/Dev.zip
EXILED_REFERENCES: ${{ github.workspace }}/refs
NWAPIPERMSYSTEM_URL: https://github.com/CedModV2/NWAPIPermissionSystem/releases/latest/download/NWAPIPermissionSystem.dll
jobs:
main:
runs-on: windows-latest
steps:
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1.1.3
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/setup-nuget@v1.0.5
- uses: actions/checkout@v2.3.4
- 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: Get nwapipermissionsystem
shell: pwsh
run: |
Invoke-WebRequest -Uri ${{ env.NWAPIPERMSYSTEM_URL }} -OutFile ${{ env.EXILED_REFERENCES }}/NWAPIPermissionSystem.dll
- 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 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 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/release-action@v1.13.0
if: ${{ env.newversion == 'true' }}
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 }}