From 08702f14aba9210fe9ffc807928ddbfa7a9f5766 Mon Sep 17 00:00:00 2001 From: Kalle Minkner Date: Mon, 11 Nov 2024 12:17:30 +0100 Subject: [PATCH] fix: automatic build only on Version.cs --- .github/workflows/release.yml | 19 +++++++++++-------- src/MapModifiers.cs | 1 - src/Version.cs | 10 ++++++++++ 3 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 src/Version.cs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d3804c..ff47e0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,18 @@ -name: Create Release +name: Build Release + +env: + REPOSITORY_FOLDER: "src" # subfolder with source code + PLUGIN_NAME: "MapModifiers" # 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: "MapModifiers" # main file of the project - +# job to create a new release jobs: create-release: runs-on: ubuntu-latest @@ -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 @@ -56,7 +59,7 @@ jobs: if: env.new_version == 'true' run: dotnet publish -c Release - - name: Prepare CS2-UpdateManager ${{ env.REPOSITORY_NAME }}.info + - name: Prepare ${{ env.REPOSITORY_NAME }}.info if: env.new_version == 'true' run: | echo "version: ${{ env.version }}" > /home/runner/work/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0/publish/${{ env.PLUGIN_NAME }}.info diff --git a/src/MapModifiers.cs b/src/MapModifiers.cs index b76e244..5dc129a 100644 --- a/src/MapModifiers.cs +++ b/src/MapModifiers.cs @@ -7,7 +7,6 @@ public partial class MapModifiers : BasePlugin, IPluginConfig { public override string ModuleName => "Map Modifiers Plugin"; public override string ModuleAuthor => "Jon-Mailes Graeffe / Kalle "; - public override string ModuleVersion => "0.0.12"; private string _currentMap = ""; diff --git a/src/Version.cs b/src/Version.cs new file mode 100644 index 0000000..43d9d62 --- /dev/null +++ b/src/Version.cs @@ -0,0 +1,10 @@ +using CounterStrikeSharp.API; +using CounterStrikeSharp.API.Core; + +namespace MapModifiers +{ + public partial class MapModifiers : BasePlugin + { + public override string ModuleVersion => "0.0.12"; + } +} \ No newline at end of file