Skip to content

Commit

Permalink
Merge pull request #25 from Twinki14/add-continous-integration
Browse files Browse the repository at this point in the history
Add GitHub Actions based Continuous Integration
  • Loading branch information
manups4e authored Mar 12, 2024
2 parents 2cfa0e4 + c568bc9 commit d02ed32
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 5 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build - Publish
on:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
is-tag: ${{ startsWith(github.ref, 'refs/tags/') }}

jobs:
build:
runs-on: windows-latest
strategy:
matrix:
client: ['FiveM', 'RedM']
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup - GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
preferLatestVersion: true

- name: Setup - dotnet framework 4.8
run: |
choco install netfx-4.8-devpack -y
dotnet --version # Verify installation
- name: Setup - dotnet 8
uses: actions/setup-dotnet@v4
with:
source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
env:
NUGET_AUTH_TOKEN: ${{ github.token }}

- name: GitVersion
id: git-version
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true

- name: Dotnet - Restore
run: dotnet restore

- name: Dotnet - Build
run: dotnet build -c "Release ${{ matrix.client }}" --no-restore

- name: Dotnet - Test
run: dotnet test -c "Release ${{ matrix.client }}" --no-restore

- name: Dotnet - Pack
run: dotnet pack -c "Release ${{ matrix.client }}" --no-restore

- name: Publish - NuGet
if: ${{ env.is-tag == 'true' }}
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
working-directory: FxEvents/CompiledLibs

- name: Publish - GitHub
if: ${{ env.is-tag == 'true' }}
run: dotnet nuget push **/*.nupkg --skip-duplicate
working-directory: FxEvents/CompiledLibs
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,7 @@ FodyWeavers.xsd
[Rr]elease [Rr]ed[Mm]/
[Rr]elease [Ff]ive[Mm]/
[Dd]ebug [Rr]ed[Mm]/
[Dd]ebug [Ff]ive[Mm]/
[Dd]ebug [Ff]ive[Mm]/

# .idea files - Rider / JetBrains IDE's
.idea
8 changes: 5 additions & 3 deletions FxEvents/FxEvents.Client/FxEvents.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
<Nullable>annotations</Nullable>
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<AssemblyVersion></AssemblyVersion>
<FileVersion></FileVersion>
<Version>2.6.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug FiveM' Or '$(Configuration)' == 'Debug RedM'">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -69,6 +66,11 @@

<PackageReference Include="CitizenFX.Core.Client" Version="1.0.7257" />

<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageReference Include="Newtonsoft.Json" Version="12.0.2" ExcludeAssets="Compile" GeneratePathProperty="true" />
<Reference Include="Newtonsoft.Json">
<HintPath>$(PkgNewtonsoft_Json)\lib\portable-net40+sl5+win8+wp8+wpa81\Newtonsoft.Json.dll</HintPath>
Expand Down
5 changes: 4 additions & 1 deletion FxEvents/FxEvents.Server/FxEvents.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<Configurations>Debug;Release</Configurations>
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Version>2.6.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -35,6 +34,10 @@

<ItemGroup>
<PackageReference Include="CitizenFX.Core.Server" Version="1.0.7257" />
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" ExcludeAssets="Compile" GeneratePathProperty="true" />
<Reference Include="MsgPack">
Expand Down
10 changes: 10 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
mode: ContinuousDelivery
branches:
master:
mode: ContinuousDeployment
tag: ci
track-merge-target: true
ignore:
sha: []
merge-message-formats: {}
tag-prefix: ""

0 comments on commit d02ed32

Please sign in to comment.