Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github CI/CD Pipeline and Updated .NET Framework #7

Open
wants to merge 20 commits into
base: feature_ci
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .github/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mode: ContinuousDeployment
branches:
master:
tag: beta
hotfix:
tag: useBranchName
93 changes: 93 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
versionSpec: "5.x"

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
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 }}
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
versionSpec: "5.x"

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
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
2 changes: 1 addition & 1 deletion Configuration/LocaleConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.Globalization;
using JetBrains.Annotations;

namespace NFive.SDK.Core.Configuration
{
Expand Down
2 changes: 1 addition & 1 deletion Configuration/SteamId.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using JetBrains.Annotations;
using System;

namespace NFive.SDK.Core.Configuration
{
Expand Down
120 changes: 38 additions & 82 deletions NFive.SDK.Core.csproj
Original file line number Diff line number Diff line change
@@ -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>
17 changes: 0 additions & 17 deletions NFive.SDK.Core.nuspec

This file was deleted.

16 changes: 0 additions & 16 deletions Properties/AssemblyInfo.cs

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NFive Core SDK
[![License](https://img.shields.io/github/license/NFive/SDK.Core.svg)](LICENSE)
[![Build Status](https://img.shields.io/appveyor/ci/NFive/sdk-core.svg)](https://ci.appveyor.com/project/NFive/sdk-core)
[![NuGet Version](https://img.shields.io/nuget/v/NFive/SDK.Core.svg)](https://www.nuget.org/packages/NFive.SDK.Core)
[![Build Status](https://img.shields.io/github/actions/workflow/status/NFive/SDK.Core/ci.yml)](https://github.com/NFive/SDK.Core/actions/workflows/ci.yml)
[![NuGet Version](https://img.shields.io/nuget/v/NFive.SDK.Core)](https://www.nuget.org/packages/NFive.SDK.Core/)
[![Release Version](https://img.shields.io/github/release/NFive/SDK.Core/all.svg)](https://github.com/NFive/SDK.Core/releases)

[NFive](https://nfive.io/) SDK for developing plugins.
Loading