Skip to content

Commit

Permalink
add CI, make age check non prime only
Browse files Browse the repository at this point in the history
  • Loading branch information
jithatsonei committed Apr 19, 2024
1 parent 432170e commit becc475
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
73 changes: 73 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion src/KitsuneSteamRestrict.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit becc475

Please sign in to comment.