Skip to content

Commit

Permalink
CI/CD improvements (#26)
Browse files Browse the repository at this point in the history
Add GitVersion & add some (hopefully working) CI/CD infrastructure
  • Loading branch information
Mooshua authored Feb 6, 2024
2 parents 79f161b + 81c2194 commit 7cb5c22
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 12 deletions.
18 changes: 18 additions & 0 deletions .github/release_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[![EdgeGamers](https://cdn.edgm.io/images/brand/ego_text_blue.webp)](https://edgm.rs/)⠀⠀[![Discord](https://img.shields.io/discord/161245089774043136?style=for-the-badge&logo=discord&logoColor=%23ffffff&label=Join%20Our%20Discord&color=%235865F2
)](https://edgm.rs/discord)⠀⠀[![Commits](https://img.shields.io/badge/COMMITS-gray?style=for-the-badge&logo=git&logoColor=%23fff&color=f05032)](https://github.com/edgegamers/Jailbreak/commits/1.0.0)

## Major Changes
- **⚙️ Server**
- **👮 Guards**
- **🎃 Prisoners**
- **🛕 Maps**

## Installing

To install Jailbreak, download the `jailbreak.zip` file below and extract it into your CounterStrikeSharp `plugins` directory.
Jailbreak is ready-to-run out of the box without any additional configuration.

## Known Issues

*No known issues yet!*
To report a bug or issue with this release, please [open an issue](https://github.com/edgegamers/Jailbreak/issues)
19 changes: 10 additions & 9 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,40 @@ on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Insert Job Version
run: sed -i "s/{GIT_VERSION}/${{github.run_number}}/g" src/Jailbreak/Jailbreak.cs

with:
fetch-depth: 0
fetch-tags: true
show-progress: true,

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- run: |
dotnet restore
dotnet build src/Jailbreak/Jailbreak.csproj --no-restore
dotnet publish src/Jailbreak/Jailbreak.csproj --no-build --no-restore
- uses: actions/[email protected]
with:
name: jailbreak-nightly
path: build
path: build/Jailbreak
# If build didn't put any artifacts in the build folder, consider it an error
if-no-files-found: error
post_webhook:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev'

steps:
- name: POST Webhook
run: |
curl -X POST \
--fail \
-F token=${{ secrets.GITLAB_SECRET_TOKEN }} \
-F ref=dev \
https://gitlab.edgegamers.io/api/v4/projects/2594/trigger/pipeline
https://gitlab.edgegamers.io/api/v4/projects/2594/trigger/pipeline
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
branches-ignore:
- "*"
tags:
- "*"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
show-progress: true,

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- run: |
dotnet restore
dotnet build src/Jailbreak/Jailbreak.csproj --no-restore
dotnet publish src/Jailbreak/Jailbreak.csproj --no-build --no-restore
- uses: actions/[email protected]
with:
name: jailbreak
path: build/Jailbreak
# If build didn't put any artifacts in the build folder, consider it an error
if-no-files-found: error

- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
fail_on_unmatched_files: true
files: build/Jailbreak.zip
body_path: .github/release_template.md
4 changes: 2 additions & 2 deletions src/Jailbreak/Jailbreak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Jailbreak(IServiceProvider provider)
public override string ModuleName => "Jailbreak";

/// <inheritdoc />
public override string ModuleVersion => "1.0.0.{GIT_VERSION}";
public override string ModuleVersion => $"{GitVersionInformation.SemVer} ({GitVersionInformation.ShortSha})";

/// <inheritdoc />
public override string ModuleAuthor => "EdgeGamers Development";
Expand Down Expand Up @@ -74,4 +74,4 @@ public override void Unload(bool hotReload)

base.Unload(hotReload);
}
}
}
40 changes: 39 additions & 1 deletion src/Jailbreak/Jailbreak.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,34 @@
<!--CI Configurations-->
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup>
<!--GitVersion Configuration-->
<UpdateAssemblyInfo>true</UpdateAssemblyInfo>
<UpdateVersionProperties>true</UpdateVersionProperties>

<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>

<GitVersion_NoFetchEnabled>false</GitVersion_NoFetchEnabled>
<GitVersion_NoCacheEnabled>true</GitVersion_NoCacheEnabled>

<GitVersion_ToolArgments>$(GitVersion_ToolArgments) /verbosity Normal</GitVersion_ToolArgments>
<GitVersion_ToolArgments>$(GitVersion_ToolArgments) /overrideconfig mode=ContinuousDelivery</GitVersion_ToolArgments>
<GitVersion_ToolArgments>$(GitVersion_ToolArgments) /overrideconfig assembly-file-versioning-format="{SemVer}"</GitVersion_ToolArgments>
<GitVersion_ToolArgments>$(GitVersion_ToolArgments) /overrideconfig assembly-versioning-format="{Major}.{Minor}.{Patch}.{CommitsSinceVersionSource}"</GitVersion_ToolArgments>
<GitVersion_ToolArgments>$(GitVersion_ToolArgments) /overrideconfig assembly-informational-format="{FullSemVer}{EscapedBranchName}"</GitVersion_ToolArgments>
<GitVersion_ToolArgments>$(GitVersion_ToolArgments) /overrideconfig commit-message-incrementing=Disabled</GitVersion_ToolArgments>
<GitVersion_ToolArgments>$(GitVersion_ToolArgments) /overrideconfig increment=Patch</GitVersion_ToolArgments>

</PropertyGroup>

<PropertyGroup>
<!--Publish Configuration-->
<PublishDir>$(MSBuildThisFileDirectory)/../../build/Jailbreak</PublishDir>
<PublishBaseDirectory>$(MSBuildThisFileDirectory)/../../build</PublishBaseDirectory>
<PublishDir>$(PublishBaseDirectory)/Jailbreak</PublishDir>

<PublishRelease>false</PublishRelease>
<PublishSelfContained>false</PublishSelfContained>
<PublishDocumentationFile>true</PublishDocumentationFile>
Expand All @@ -42,4 +66,18 @@
<ProjectReference Include="..\Jailbreak.Generic\Jailbreak.Generic.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="6.0.0-beta.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<Target Name="ZipOutputPath" AfterTargets="Publish">
<ZipDirectory
Overwrite="true"
SourceDirectory="$(PublishDir)\"
DestinationFile="$(PublishBaseDirectory)\Jailbreak.zip" />
</Target>

</Project>

0 comments on commit 7cb5c22

Please sign in to comment.