Skip to content

Commit

Permalink
chore: add build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlucas committed Jun 8, 2024
1 parent 7b7abe9 commit 948bd47
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
50 changes: 50 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Release

on:
workflow_dispatch:

env:
project_name: InventorySimulator

jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Generate build number
id: buildnumber
uses: onyxmueller/build-tag-number@v1
with:
token: ${{ secrets.github_token }}

- name: Checkout code
uses: actions/checkout@v3

- name: Update module version
run: |
sed -i 's/ModuleVersion => "1.0.0"/ModuleVersion => "1.${{ steps.buildnumber.outputs.build_number }}.0"/g' source/${{ env.project_name }}/${{ env.project_name }}.cs
- name: Set up .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'

- name: Restore dependencies
run: dotnet restore

- name: Build the project
run: dotnet build

- name: Zip release
run: |
(cd bin/Release && zip -r ../../${{ env.project_name }}-v${{ steps.buildnumber.outputs.build_number }}.zip .)
- name: Release
id: release
uses: softprops/action-gh-release@v1
with:
body: ${{ env.project_name }} (v${{ steps.buildnumber.outputs.build_number }})
tag_name: v${{ steps.buildnumber.outputs.build_number }}
files: |
${{ env.project_name }}-v${{ steps.buildnumber.outputs.build_number }}.zip
1 change: 1 addition & 0 deletions InventorySimulator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.234" />
<PackageReference Include="newtonsoft.json" Version="13.0.3" />
<LangFiles Include="source\InventorySimulator\lang\**\*.*" />
<None Include=".github\workflows\build-and-release.yml" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="Build">
Expand Down
2 changes: 1 addition & 1 deletion source/InventorySimulator/InventorySimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public partial class InventorySimulator : BasePlugin
public override string ModuleAuthor => "Ian Lucas";
public override string ModuleDescription => "Inventory Simulator (inventory.cstrike.app)";
public override string ModuleName => "InventorySimulator";
public override string ModuleVersion => "1.0.0-beta.29";
public override string ModuleVersion => "1.0.0";

public override void Load(bool hotReload)
{
Expand Down

0 comments on commit 948bd47

Please sign in to comment.