Skip to content

Commit

Permalink
fix: automatic build only on Version.cs change
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalle Minkner committed Nov 11, 2024
1 parent e0b4f5f commit a3e03ad
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: Create Release
name: Build Release

env:
REPOSITORY_FOLDER: "src" # subfolder with source code
PLUGIN_NAME: "TeamBalancer" # main file of the project

on:
push:
branches:
- main
paths:
- 'src/Version.cs' # only on change of the file with the version number string in it
workflow_dispatch:

env:
REPOSITORY_FOLDER: "src" # subfolder with source code
PLUGIN_NAME: "TeamBalancer" # main file of the project

# job to create a new release
jobs:
create-release:
runs-on: ubuntu-latest
Expand All @@ -21,10 +24,10 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Get Current Project Version Number From ${{ env.PLUGIN_NAME }}.cs
- name: Get Current Project Version Number From Version.cs
id: get_version
run: |
version=$(grep -oP '(?<=ModuleVersion => ")[^"]*' ${{ env.REPOSITORY_FOLDER }}/${{ env.PLUGIN_NAME }}.cs)
version=$(grep -oP '(?<=ModuleVersion => ")[^"]*' ${{ env.REPOSITORY_FOLDER }}/Version.cs)
echo "version=$version" >> $GITHUB_ENV
- name: Get Current Release Version Number
Expand Down
1 change: 0 additions & 1 deletion src/TeamBalancer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public partial class TeamBalancer : BasePlugin
{
public override string ModuleName => "Team Balancer";
public override string ModuleAuthor => "Jon-Mailes Graeffe <[email protected]> / Kalle <[email protected]>";
public override string ModuleVersion => "0.0.5";

private bool _halfTime = true;

Expand Down
11 changes: 11 additions & 0 deletions src/Version.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;

namespace TeamBalancer
{
public partial class TeamBalancer : BasePlugin
{
public override string ModuleVersion => "0.0.5";
}
}

0 comments on commit a3e03ad

Please sign in to comment.