Skip to content

Commit

Permalink
Feature: more info about redm (#121)
Browse files Browse the repository at this point in the history
* better info for `redm` command

* CI: rework versioning
  • Loading branch information
SergeyShorokhov authored Jun 18, 2024
1 parent 52211a5 commit bd29be7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
COMMIT_SHA: ${{ steps.declare_sha.outputs.COMMIT_SHA }}
SEMVER: ${{ steps.declare_sha.outputs.SEMVER }}
SEMVER_PATCH: ${{ steps.declare_sha.outputs.SEMVER }}
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -41,7 +41,7 @@ jobs:
run: |
SHA=$(git rev-parse --short HEAD)
echo "COMMIT_SHA=$SHA" >> $GITHUB_OUTPUT
echo "SEMVER=${{ steps.semver_parser.outputs.fullversion }}" >> $GITHUB_OUTPUT
echo "SEMVER_PATCH=${{ steps.semver_parser.outputs.patch }}.${{ steps.semver_parser.outputs.prerelease }}" >> $GITHUB_OUTPUT
- name: Setup latest ReAPI includes
env:
Expand All @@ -68,14 +68,14 @@ jobs:
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
env:
PLUGIN_VERSION: "${{ steps.declare_sha.outputs.SEMVER }}"
run: sed -i "s|%VERSION%|$PLUGIN_VERSION|g" redm_version.inc
PLUGIN_VERSION: "${{ steps.declare_sha.outputs.SEMVER_PATCH }}"
run: sed -i "s|manual|$PLUGIN_VERSION|g" redm_version.inc

- name: Update versions for plugins (only for artifacts builds)
working-directory: cstrike/addons/amxmodx/scripting/include/
env:
PLUGIN_VERSION: "${{ steps.declare_sha.outputs.COMMIT_SHA }}"
run: sed -i "s|%VERSION%|$PLUGIN_VERSION|g" redm_version.inc
run: sed -i "s|manual|$PLUGIN_VERSION|g" redm_version.inc

- name: Setup AMXXPawn Compiler
uses: wopox1337/[email protected]
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:

- name: Packaging binaries
id: packaging
run: 7z a -mm=Deflate -mfb=258 -mpass=15 -r ReDeathmatch-${{ needs.build.outputs.SEMVER }}.zip cstrike/
run: 7z a -mm=Deflate -mfb=258 -mpass=15 -r ReDeathmatch-${{ needs.build.outputs.SEMVER_PATCH }}.zip cstrike/

- name: Publish artifacts
uses: softprops/[email protected]
Expand Down
12 changes: 10 additions & 2 deletions cstrike/addons/amxmodx/scripting/ReDeathmatch.sma
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public plugin_init() {
register_concmd("redm_enable", "ConCmd_redm_enable", ADMIN_MAP, "Enables Re:DM.")
register_concmd("redm_disable", "ConCmd_redm_disable", ADMIN_MAP, "Disables Re:DM.")
register_concmd("redm_status", "ConCmd_redm_status", ADMIN_MAP, "Get Re:DM status.")
register_concmd("redm", "ConCmd_redm", ADMIN_ALL, "Get info.", .FlagManager = false)
register_concmd("redm", "ConCmd_redm", ADMIN_MAP, "Get info.", .FlagManager = false)

ApiInit_Forwards()
}
Expand Down Expand Up @@ -210,7 +210,15 @@ public ConCmd_redm(const player, const level, const commandId) {

console_print(player, "[Re:DM] Version `%s`", REDM_VERSION)
console_print(player, "[Re:DM] https://github.com/wopox1337/ReDeathmatch")
console_print(player, "[Re:DM] Copyright (c) 2023 Sergey Shorokhov", REDM_VERSION)
console_print(player, "[Re:DM] Copyright (c) 2024 Sergey Shorokhov")

if (!cmd_access(player, level, commandId, 1, .accesssilent = true))
return PLUGIN_HANDLED

console_print(player, "Compilation info:")
console_print(player, " AMXX version: `%s`", AMXX_VERSION_STR)
console_print(player, " ReAPI version: `%i.%i`", REAPI_VERSION_MAJOR, REAPI_VERSION_MINOR)
console_print(player, " Time: `%s %s`", __DATE__, __TIME__)

return PLUGIN_HANDLED
}
Expand Down
6 changes: 5 additions & 1 deletion cstrike/addons/amxmodx/scripting/include/redm_version.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
#define _redm_version_included

// redm version
new const REDM_VERSION[] = "%VERSION%"
#define REDM_VERSION_MAJOR 1
#define REDM_VERSION_MINOR 0
#define REDM_VERSION_PATCH "manual"

#define REDM_VERSION fmt("%i.%i." + REDM_VERSION_PATCH, REDM_VERSION_MAJOR, REDM_VERSION_MINOR)

0 comments on commit bd29be7

Please sign in to comment.