Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- Base must be irsdl/ysonet:master. If you see a different base, change it via the dropdowns. -->

### Summary

### Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] **Major / breaking** -> please add the `major` label

### Checklist
- [ ] PR targets **irsdl/ysonet:master**
- [ ] Builds pass (see CI)
48 changes: 31 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
on: [push, pull_request]
name: CI Build

name: Build
on:
workflow_dispatch:
pull_request:
branches: [ master ]

permissions:
contents: read

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v1
- name: Restore packages
run: nuget restore ysoserial.sln
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.1
- name: Build with MSBuild
run: msbuild ysoserial.sln -p:Configuration=Release
- name: Prepare build artifact for stashing
- uses: actions/checkout@v4

- name: Setup NuGet
uses: NuGet/setup-nuget@v2

- name: Restore
run: nuget restore ysonet.sln

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Build (Release)
run: msbuild ysonet.sln -p:Configuration=Release

- name: Collect artifacts
shell: pwsh
run: |
mkdir release
move D:\a\ysoserial.net\ysoserial.net\ysoserial\bin\Release .\release
New-Item -ItemType Directory -Path release | Out-Null
Move-Item .\ysonet\bin\Release\* .\release\ -Force

- name: Upload artifact
uses: actions/upload-artifact@v4.0.0
uses: actions/upload-artifact@v4
with:
name: ysoserial-${{ github.sha }}
path: .\release
name: ysonet-${{ github.sha }}
path: release
if-no-files-found: error
86 changes: 86 additions & 0 deletions .github/workflows/prepare-major-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Prepare Major Release PR

on:
pull_request:
types: [closed]
branches: [ master ]

permissions:
contents: write
pull-requests: write

jobs:
prepare:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- name: Check for `major` label
id: gate
run: |
labels='${{ toJson(github.event.pull_request.labels) }}'
echo "is_major=false" >> $GITHUB_OUTPUT
echo "$labels" | grep -qi '"name":"major"' && echo "is_major=true" >> $GITHUB_OUTPUT || true

- name: Stop if not major
if: steps.gate.outputs.is_major != 'true'
run: echo "Merged PR is not labeled 'major' - skipping."

- name: Checkout
if: steps.gate.outputs.is_major == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Bump VERSION and update projects
if: steps.gate.outputs.is_major == 'true'
shell: pwsh
run: |
$versionPath = Join-Path $PWD "VERSION"
if (-not (Test-Path $versionPath)) { throw "VERSION file not found" }
$cur = (Get-Content $versionPath -Raw).Trim()
if ($cur -notmatch '^v(\d+)\.(\d+)$') { throw "VERSION must be vN.NN, got '$cur'" }
$nextMaj = [int]$Matches[1] + 1
$new = "v{0}.00" -f $nextMaj
Set-Content -NoNewline -Path $versionPath -Value $new
Write-Host "VERSION: $cur -> $new"

$info = "$new+ysonet"

# Update all .csproj files
Get-ChildItem -Recurse -Filter *.csproj | ForEach-Object {
[xml]$xml = Get-Content $_.FullName
$pg = $xml.Project.PropertyGroup | Select-Object -First 1
if (-not $pg) { $pg = $xml.CreateElement('PropertyGroup'); $xml.Project.AppendChild($pg) | Out-Null }

# AssemblyInformationalVersion = vN.NN+ysonet
$ainf = $pg.AssemblyInformationalVersion | Select-Object -First 1
if ($ainf) { $ainf.InnerText = $info } else {
$n = $xml.CreateElement('AssemblyInformationalVersion'); $n.InnerText = $info; $pg.AppendChild($n) | Out-Null
}

# Optional numeric Version (safe if you don't publish to NuGet)
$numeric = ($new.TrimStart('v') -replace '\.00$', '.0.0') # v2.00 -> 2.0.0
$verNode = $pg.Version | Select-Object -First 1
if ($verNode) { $verNode.InnerText = $numeric } else {
$vn = $xml.CreateElement('Version'); $vn.InnerText = $numeric; $pg.AppendChild($vn) | Out-Null
}

$xml.Save($_.FullName)
Write-Host "Updated $($_.FullName)"
}

- name: Create Release PR
if: steps.gate.outputs.is_major == 'true'
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore(release): prepare $(cat VERSION)"
title: "Release $(cat VERSION)"
body: |
Prepare **$(cat VERSION)**.
- Bump `VERSION`
- Stamp `.csproj` `AssemblyInformationalVersion` to `$(cat VERSION)+ysonet`
branch: release/$(cat VERSION)
labels: release
signoff: true
delete-branch: true
100 changes: 100 additions & 0 deletions .github/workflows/tag-build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Tag, Build & Publish Release

on:
push:
branches: [ master ]
paths:
- "VERSION"
workflow_dispatch:
inputs:
version:
description: "Version string like v1.00"
required: true
default: "v1.00"
type: string
create_tag:
description: "Create tag if it doesn't exist"
required: true
default: false
type: boolean

permissions:
contents: write
actions: read

jobs:
release:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Determine version
id: v
shell: pwsh
run: |
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
$v = "${{ inputs.version }}".Trim()
} else {
$v = (Get-Content VERSION -Raw).Trim()
}
if ($v -notmatch '^v\d+\.\d+$') { throw "Unexpected VERSION format: $v" }
$tag = "ysonet/$v"
"value=$v" >> $env:GITHUB_OUTPUT
"tag=$tag" >> $env:GITHUB_OUTPUT
Write-Host "Version: $v"
Write-Host "Tag: $tag"

- name: Check if tag already exists
id: tagcheck
shell: bash
run: |
if git rev-parse -q --verify "refs/tags/${{ steps.v.outputs.tag }}" >/dev/null; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Create annotated tag
if: |
# Define conditions for better readability
${{ github.event_name == 'push' }} ||
${{
github.event_name == 'workflow_dispatch' &&
inputs.create_tag == true &&
steps.tagcheck.outputs.exists == 'false'
}}
shell: pwsh
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${{ steps.v.outputs.tag }}" -m "Release ${{ steps.v.outputs.value }} (ysonet)"
git push origin "${{ steps.v.outputs.tag }}"

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Setup NuGet
uses: NuGet/setup-nuget@v2

- name: Restore
run: nuget restore ysonet.sln

- name: Build (Release)
run: msbuild ysonet.sln -p:Configuration=Release -m

- name: Package artifact
shell: pwsh
run: |
New-Item -ItemType Directory -Path dist | Out-Null
Compress-Archive -Path ".\ysonet\bin\Release\*" -DestinationPath "dist\ysonet-${{ steps.v.outputs.value }}.zip" -Force

- name: Publish GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.v.outputs.tag }}
name: "[ysonet] ${{ steps.v.outputs.value }}"
generateReleaseNotes: true
artifacts: "dist/ysonet-${{ steps.v.outputs.value }}.zip"
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ ModelManifest.xml
.fake/

# Tests
ysoserial/Helpers/TestingArena/
ysonet/Helpers/TestingArena/

# Rider
.idea
.idea
ysonet/Helpers/TestingArena/TestingArenaHome.cs
/ExploitClass/ExploitSamples
4 changes: 2 additions & 2 deletions ExploitClass/ExploitClass.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\ysoserial\bin\Debug\</OutputPath>
<OutputPath>..\ysonet\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\ysoserial\bin\Release\</OutputPath>
<OutputPath>..\ysonet\bin\Release\</OutputPath>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017-2019 Alvaro Muñoz
Copyright (c) 2025 Soroush Dalili

MIT License

Expand Down
Loading
Loading