Skip to content

Commit

Permalink
fix: automatic build only on Version.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalle Minkner committed Nov 11, 2024
1 parent 72cda93 commit 08702f1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
19 changes: 11 additions & 8 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: "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
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 Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/MapModifiers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public partial class MapModifiers : BasePlugin, IPluginConfig<PluginConfig>
{
public override string ModuleName => "Map Modifiers Plugin";
public override string ModuleAuthor => "Jon-Mailes Graeffe <[email protected]> / Kalle <[email protected]>";
public override string ModuleVersion => "0.0.12";

private string _currentMap = "";

Expand Down
10 changes: 10 additions & 0 deletions src/Version.cs
Original file line number Diff line number Diff line change
@@ -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";
}
}

0 comments on commit 08702f1

Please sign in to comment.