diff --git a/.github/version.yml b/.github/version.yml new file mode 100644 index 0000000..a013f09 --- /dev/null +++ b/.github/version.yml @@ -0,0 +1,6 @@ +mode: ContinuousDeployment +branches: + master: + tag: beta + hotfix: + tag: useBranchName \ No newline at end of file diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..992e665 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,93 @@ +name: Continuous Deployment + +on: + push: + tags: + - "*" + +jobs: + calculate-version: + name: Calculate Version + runs-on: ubuntu-latest + outputs: + semVer: ${{ steps.gitversion.outputs.semVer }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.11.0 + with: + versionSpec: "5.x" + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0.11.0 + with: + useConfigFile: true + configFilePath: ./.github/version.yml + + build: + name: Build and Release + runs-on: windows-latest + needs: calculate-version + env: + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages + SEMVER: ${{ needs.calculate-version.outputs.semVer }} + ZipName: NFive.SDK.Core-${{ needs.calculate-version.outputs.semVer }}.zip + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 2.0.x + + - uses: actions/cache@v4 + with: + path: ${{ github.workspace }}\.nuget\packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: Restore dependencies + run: dotnet restore NFive.SDK.Core.sln + + - name: Build the solution + run: dotnet build --no-restore -c Release -o Build /p:Version=${{env.SEMVER}} NFive.SDK.Core.sln + + - uses: vimtor/action-zip@v1 + with: + files: Build/ + dest: ${{ env.ZipName }} + + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.SEMVER }} + release_name: ${{ env.SEMVER }} + draft: false + prerelease: false + + - name: Update release asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .\${{ env.ZipName }} + asset_name: ${{ env.ZipName }} + asset_content_type: application/zip + + - name: Pack + run: dotnet pack NFive.SDK.Core.csproj -p:PackageVersion=${{ env.SEMVER }} --configuration Release + + - name: Push nuget package + run: dotnet nuget push **/*.nupkg --skip-duplicate --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.nuget_api_key }} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c8b28cb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: Continuous Integration + +on: + push: + branches: + - "**" + tags: + - "v*.*.*" + pull_request: + branches: + - "**" + +jobs: + calculate-version: + name: Calculate Version + runs-on: ubuntu-latest + outputs: + semVer: ${{ steps.gitversion.outputs.semVer }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.11.0 + with: + versionSpec: "5.x" + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0.11.0 + with: + useConfigFile: true + configFilePath: ./.github/version.yml + + build: + runs-on: windows-latest + needs: calculate-version + env: + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages + SEMVER: ${{ needs.calculate-version.outputs.semVer }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 2.0.x + + - uses: actions/cache@v4 + with: + path: ${{ github.workspace }}\.nuget\packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: Restore dependencies + run: dotnet restore NFive.SDK.Core.sln + + - name: Build the solution + run: dotnet build --no-restore -c Release -o Build /p:Version=${{env.SEMVER}} NFive.SDK.Core.sln + + - name: Attach Zip as build artifact + uses: actions/upload-artifact@v4 + with: + name: NFive.SDK.Core-${{ env.SEMVER }} + path: Build \ No newline at end of file diff --git a/Configuration/LocaleConfiguration.cs b/Configuration/LocaleConfiguration.cs index b597664..83656e1 100644 --- a/Configuration/LocaleConfiguration.cs +++ b/Configuration/LocaleConfiguration.cs @@ -1,7 +1,7 @@ +using JetBrains.Annotations; using System; using System.Collections.Generic; using System.Globalization; -using JetBrains.Annotations; namespace NFive.SDK.Core.Configuration { diff --git a/Configuration/SteamId.cs b/Configuration/SteamId.cs index 50c8bc4..7276bb4 100644 --- a/Configuration/SteamId.cs +++ b/Configuration/SteamId.cs @@ -1,5 +1,5 @@ -using System; using JetBrains.Annotations; +using System; namespace NFive.SDK.Core.Configuration { diff --git a/NFive.SDK.Core.csproj b/NFive.SDK.Core.csproj index 78b1ecb..d46d3a0 100644 --- a/NFive.SDK.Core.csproj +++ b/NFive.SDK.Core.csproj @@ -1,93 +1,49 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{C1DE80C7-579E-4D48-AAB8-37F5C1484F86}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> + <TargetFramework>net471</TargetFramework> <RootNamespace>NFive.SDK.Core</RootNamespace> <AssemblyName>NFive.SDK.Core.net</AssemblyName> - <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <AllowedReferenceRelatedFileExtensions> - .allowedextension - </AllowedReferenceRelatedFileExtensions> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>false</DebugSymbols> - <DebugType>none</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugSymbols>false</DebugSymbols> - <DebugType>none</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> + <PackageId>NFive.SDK.Core</PackageId> + <Authors>NFive</Authors> + <Owners>NFive</Owners> + <PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression> + <Tags>nfive fivem gtav</Tags> + <RequireLicenseAcceptance>false</RequireLicenseAcceptance> + <RepositoryUrl>https://github.com/NFive/SDK.Core</RepositoryUrl> + <RepositoryType>git</RepositoryType> + <Description>NFive Core SDK for plugins</Description> + <Title>NFive.SDK.Core</Title> + <PackageProjectUrl>https://github.com/NFive</PackageProjectUrl> + <PackageIcon>icon.png</PackageIcon> + <PackageTags>nfive fivem gtav</PackageTags> + <Version>0.1.4</Version> + <Description>NFive core SDK for plugin development</Description> + <PackageReadmeFile>README.md</PackageReadmeFile> + <Copyright>Copyright © NFive 2018-2024</Copyright> + <NeutralLanguage>en-US</NeutralLanguage> </PropertyGroup> + <ItemGroup> - <Reference Include="JetBrains.Annotations, Version=2021.2.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL"> - <HintPath>packages\JetBrains.Annotations.2021.2.0\lib\net20\JetBrains.Annotations.dll</HintPath> - <Private>False</Private> - </Reference> - <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> - <HintPath>packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> - <Private>False</Private> - </Reference> - <Reference Include="System" /> - <Reference Include="System.ComponentModel.DataAnnotations" /> + <None Include="images\icon.png"> + <Pack>True</Pack> + <PackagePath>\</PackagePath> + </None> </ItemGroup> + <ItemGroup> - <Compile Include="Configuration\LocaleConfiguration.cs" /> - <Compile Include="Configuration\SteamId.cs" /> - <Compile Include="Controllers\ControllerConfiguration.cs" /> - <Compile Include="Controllers\IControllerConfiguration.cs" /> - <Compile Include="Diagnostics\ILogger.cs" /> - <Compile Include="Diagnostics\LogLevel.cs" /> - <Compile Include="Extensions\StringExtensions.cs" /> - <Compile Include="Extensions\NumericExtensions.cs" /> - <Compile Include="Extensions\PositionExtensions.cs" /> - <Compile Include="Extensions\Vector2Extensions.cs" /> - <Compile Include="Extensions\Vector3Extensions.cs" /> - <Compile Include="Helpers\GuidGenerator.cs" /> - <Compile Include="Helpers\MathHelpers.cs" /> - <Compile Include="Input\ControllerInput.cs" /> - <Compile Include="Input\InputMethod.cs" /> - <Compile Include="Input\InputModifier.cs" /> - <Compile Include="Input\InputControl.cs" /> - <Compile Include="Input\KeyCode.cs" /> - <Compile Include="Locales\ILocaleCatalog.cs" /> - <Compile Include="Models\Audio\RadioStation.cs" /> - <Compile Include="Models\Color.cs" /> - <Compile Include="Models\IdentityModel.cs" /> - <Compile Include="Models\IIdentityModel.cs" /> - <Compile Include="Models\Player\Session.cs" /> - <Compile Include="Models\Player\User.cs" /> - <Compile Include="Models\Position.cs" /> - <Compile Include="Models\Vector2.cs" /> - <Compile Include="Models\Vector3.cs" /> - <Compile Include="PluginAttribute.cs" /> - <Compile Include="Plugins\Client.cs" /> - <Compile Include="Plugins\Plugin.cs" /> - <Compile Include="Plugins\Name.cs" /> - <Compile Include="Plugins\Repository.cs" /> - <Compile Include="Plugins\Server.cs" /> - <Compile Include="Plugins\Version.cs" /> - <Compile Include="Plugins\VersionRange.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Events\CoreEvents.cs" /> - <Compile Include="Utilities\Serializer.cs" /> + <None Update="README.md"> + <Pack>True</Pack> + <PackagePath>\</PackagePath> + </None> </ItemGroup> + <ItemGroup> - <None Include="packages.config" /> + <PackageReference Include="JetBrains.Annotations" Version="2022.1.0" /> + <PackageReference Include="Newtonsoft.Json" Version="12.0.3" ExcludeAssets="Compile" GeneratePathProperty="true" /> + <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> + <Reference Include="Newtonsoft.Json"> + <HintPath>$(PkgNewtonsoft_Json)\lib\portable-net40+sl5+win8+wp8+wpa81\Newtonsoft.Json.dll</HintPath> + </Reference> </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project> \ No newline at end of file diff --git a/NFive.SDK.Core.nuspec b/NFive.SDK.Core.nuspec deleted file mode 100644 index f6a6be3..0000000 --- a/NFive.SDK.Core.nuspec +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> - <metadata> - <id>NFive.SDK.Core</id> - <version>$version$</version> - <title>$title$</title> - <authors>NFive</authors> - <owners>NFive</owners> - <requireLicenseAcceptance>false</requireLicenseAcceptance> - <license type="expression">LGPL-3.0-only</license> - <projectUrl>https://github.com/NFive/SDK.Core</projectUrl> - <description>$description$</description> - <copyright>$copyright$</copyright> - <tags>nfive fivem gtav</tags> - <repository type="git" url="git://github.com/Five/SDK.Core" /> - </metadata> -</package> diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs deleted file mode 100644 index ed5dc08..0000000 --- a/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("NFive Core SDK")] -[assembly: AssemblyDescription("NFive core SDK for plugin development")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("NFive")] -[assembly: AssemblyProduct("NFive SDK")] -[assembly: AssemblyCopyright("Copyright © NFive 2018-2021")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("1ed39a02-e017-407d-8d32-fee8a1e29264")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/README.md b/README.md index e95609b..e05656c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # NFive Core SDK [](LICENSE) -[](https://ci.appveyor.com/project/NFive/sdk-core) -[](https://www.nuget.org/packages/NFive.SDK.Core) +[](https://github.com/NFive/SDK.Core/actions/workflows/ci.yml) +[](https://www.nuget.org/packages/NFive.SDK.Core/) [](https://github.com/NFive/SDK.Core/releases) [NFive](https://nfive.io/) SDK for developing plugins. diff --git a/StringValueAttribute.cs b/StringValueAttribute.cs new file mode 100644 index 0000000..a96dffe --- /dev/null +++ b/StringValueAttribute.cs @@ -0,0 +1,35 @@ +using System; + +namespace NFive.SDK.Core +{ + /// <summary> + /// This attribute is used to represent a string value + /// for a value in an enum. + /// </summary> + public class StringValueAttribute : Attribute + { + + #region Properties + + /// <summary> + /// Holds the string value for a value in an enum. + /// </summary> + public string StringValue { get; protected set; } + + #endregion + + #region Constructor + + /// <summary> + /// Constructor used to init a StringValue Attribute + /// </summary> + /// <param name="value"></param> + public StringValueAttribute(string value) + { + this.StringValue = value; + } + + #endregion + + } +} diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 978032c..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: 0.1.0.{build} - -image: Visual Studio 2019 -configuration: Release -platform: Any CPU -clone_depth: 1 - -branches: - only: - - master - -cache: -- packages -> packages.config - -test: off - -assembly_info: - patch: true - file: Properties\AssemblyInfo.cs - assembly_version: "{version}" - assembly_file_version: "{version}" - assembly_informational_version: "{version}" - -before_build: -- nuget update -self -- nuget restore - -build: - project: NFive.SDK.Core.sln - verbosity: minimal - publish_nuget: true diff --git a/images/icon.png b/images/icon.png new file mode 100644 index 0000000..1d2da72 Binary files /dev/null and b/images/icon.png differ diff --git a/packages.config b/packages.config deleted file mode 100644 index 22cb545..0000000 --- a/packages.config +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<packages> - <package id="JetBrains.Annotations" version="2021.2.0" targetFramework="net452" /> - <package id="Newtonsoft.Json" version="12.0.2" allowedVersions="[12.0.2]" targetFramework="net452" /> -</packages> \ No newline at end of file