From becc47562acc061ac2b2f0c3d20e64c4d4827581 Mon Sep 17 00:00:00 2001 From: jii Date: Fri, 19 Apr 2024 13:47:50 -0500 Subject: [PATCH] add CI, make age check non prime only --- .github/workflows/release.yml | 73 +++++++++++++++++++++++++++++++++++ src/KitsuneSteamRestrict.cs | 2 +- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f0ca0b3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,73 @@ +name: .NET Build and Release + +on: + push: + branches: + - main + - master + - dev + pull_request: + branches: + - main + - master + - dev + +jobs: + build: + runs-on: ubuntu-latest + + container: + image: mcr.microsoft.com/dotnet/nightly/sdk:8.0 + + steps: + - uses: actions/checkout@v2 + + - name: Restore dependencies + run: dotnet restore ./src/KitsuneSteamRestrict.csproj + + - name: Build + run: dotnet publish --configuration Release ./src/KitsuneSteamRestrict.csproj + + - name: Archive production artifacts + uses: actions/upload-artifact@v2 + with: + name: net8.0-artifacts + path: | + src/bin/KitsuneSteamRestrict* + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: net8.0-artifacts + path: bin/Debug/net8.0 + + - name: Archive + run: cd /home/runner/work/CS2-SteamRestrict/CS2-SteamRestrict/bin/Debug/net8.0 && zip /home/runner/work/CS2-SteamRestrict/CS2-SteamRestrict/SteamRestrict.zip ./* -r + + - name: Create Tag + id: tag_version + run: | + DATE=$(date +'%y.%m.%d-%H%M%S') + echo "RELEASE_TAG=$DATE" >> $GITHUB_ENV + + - name: Determine if Pre-release + id: prerelease + run: | + if [ "${{ github.ref }}" != "refs/heads/main" ]; then + echo "IS_PRERELEASE=true" >> $GITHUB_ENV + else + echo "IS_PRERELEASE=false" >> $GITHUB_ENV + fi + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ env.RELEASE_TAG }} + files: SteamRestrict.zip + prerelease: ${{ env.IS_PRERELEASE }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/KitsuneSteamRestrict.cs b/src/KitsuneSteamRestrict.cs index 559123b..98f32a9 100644 --- a/src/KitsuneSteamRestrict.cs +++ b/src/KitsuneSteamRestrict.cs @@ -186,7 +186,7 @@ private bool IsRestrictionViolated(CCSPlayerController player, SteamUserInfo use (!isPrime, Config.MinimumHourNonPrime, userInfo.CS2Playtime), (!isPrime, Config.MinimumLevelNonPrime, userInfo.SteamLevel), (!isPrime, Config.MinimumCS2LevelNonPrime, userInfo.CS2Level), - (true, Config.MinimumSteamAccountAgeInDays, (DateTime.Now - userInfo.SteamAccountAge).TotalDays), + (!isPrime, Config.MinimumSteamAccountAgeInDays, (DateTime.Now - userInfo.SteamAccountAge).TotalDays), (Config.BlockPrivateProfile, 1, userInfo.IsPrivate ? 0 : 1), (Config.BlockTradeBanned, 1, userInfo.IsTradeBanned ? 0 : 1), (Config.BlockGameBanned, 1, userInfo.IsGameBanned ? 0 : 1),