Skip to content

Commit

Permalink
Add CI (#15)
Browse files Browse the repository at this point in the history
* Add CI
* Move all files to cstrike/
* Add readme
* Update README.md
* Update CI
* lil fix for SHA
  • Loading branch information
wopox1337 authored Aug 5, 2021
1 parent aa0ce7a commit 0c4bd4a
Show file tree
Hide file tree
Showing 31 changed files with 245 additions and 11 deletions.
59 changes: 59 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<h1 align="center">
<a href="https://github.com/Mistrick/MapManagerModular"><img src="https://user-images.githubusercontent.com/18553678/128012021-a57c9845-d029-419e-9006-fa43ffff188a.png" width="500px" alt="Map Manager Modular"></a>
</h1>

<p align="center">Modular map management system with rich features.</p>

<p align="center">
<a href="https://github.com/Mistrick/MapManagerModular/releases/latest">
<img src="https://img.shields.io/github/downloads/Mistrick/MapManagerModular/total?label=Download%40latest&style=flat-square&logo=github&logoColor=white"
alt="Build status">
<a href="https://github.com/Mistrick/MapManagerModular/actions">
<img src="https://img.shields.io/github/workflow/status/Mistrick/MapManagerModular/CI/master?style=flat-square&logo=github&logoColor=white"
alt="Build status">
<a href="https://github.com/Mistrick/MapManagerModular/releases">
<img src="https://img.shields.io/github/v/release/Mistrick/MapManagerModular?include_prereleases&style=flat-square&logo=github&logoColor=white"
alt="Release">
<a href="https://www.amxmodx.org/downloads-new.php">
<img src="https://img.shields.io/badge/AMXModX-%3E%3D1.8.2-blue?style=flat-square"
alt="AMXModX dependency">
</p>
<p align="center">
<a href="#about">About</a> •
<a href="#requirements">Requirements</a> •
<a href="#installation">Installation</a> •
<a href="#updating">Updating</a> •
<a href="#downloads">Downloads</a> •
<a href="#features">Features</a> •
<a href="#wiki">Wiki</a>
</p>

---

## About
- TODO

## Requirements
- HLDS installed;
- Installed AMXModX ([`v1.9`](https://www.amxmodx.org/downloads-new.php) or [`v1.10`](https://www.amxmodx.org/downloads-new.php?branch=master));

## Installation
- [Download the latest](https://github.com/Mistrick/MapManagerModular/releases/latest) stable version from the release section.
- Extract the `cstrike` folder to the root folder of the HLDS server;
- Make sure that all plugins are running and in the correct order, using the `amxx list` command.

## Updating
- Put new plugins and lang-files (`plugins/*.amxx` & `data/lang/*.txt`) into `amxmodx/` folder on the HLDS server;
- Restart the server (command `restart` or change the map);
- Make sure that the versions of the plugins are up to date with the command `amxx list`.

## Downloads
- [Release builds](https://github.com/Mistrick/MapManagerModular/releases)
- [Dev builds](https://github.com/Mistrick/MapManagerModular/actions/workflows/CI.yml)

## Features
- TODO

## Wiki
Do you **need some help**? Check the _articles_ from the [wiki](https://github.com/Mistrick/MapManagerModular/wiki).
44 changes: 44 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name-template: "Release v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: "🚀 Features"
labels:
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "🧰 Maintenance"
labels:
- "maintenance"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- "major"
- "breaking"
minor:
labels:
- "minor"
- "feature"
patch:
labels:
- "patch"
- "bug"
- "maintenance"
- "docs"
- "dependencies"
- "security"
default: patch
prerelease: true
template: |
## What's Changed
$CHANGES
### Contributors
$CONTRIBUTORS
112 changes: 112 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: CI

on:
push:
branches: [master]
paths-ignore:
- "**.md"

pull_request:
types: [opened, reopened, synchronize]
release:
types: [published]

jobs:
build:
name: "Build"
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.declare_sha.outputs.sha }}
semver: ${{ steps.declare_sha.outputs.semver }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Parse SemVer string (release)
id: semver_parser
if: |
github.event_name == 'release' &&
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ github.ref }}
version_extractor_regex: '\/v(.*)$'

- name: Declare SHA & package name
id: declare_sha
shell: bash
run: |
SHA=$(git rev-parse --short HEAD)
echo "SHA_SHORT=${SHA}" >> $GITHUB_ENV
echo "::set-output name=sha::$SHA"
echo "::set-output name=semver::${{ steps.semver_parser.outputs.fullversion }}"
- name: Update versions for plugins
working-directory: cstrike/addons/amxmodx/scripting/include/
env:
SHA_SHORT: "${{ env.SHA_SHORT }}"
FILE: map_manager_consts.inc
run: sed -i "s|VERSION_HASH \"\"|VERSION_HASH \"-$SHA_SHORT\"|g" $FILE

- name: Setup AMXXPawn Compiler
uses: wopox1337/setup-amxxpawn@v1
with:
version: "1.10.5428"

- name: Compile plugins
working-directory: cstrike/addons/amxmodx/scripting/
run: |
for sourcefile in *.sma;
do
amxxfile="`echo $sourcefile | sed -e 's/\.sma$/.amxx/'`"
output_path="../plugins/$amxxfile"
mkdir -p $(dirname $output_path)
echo -n "Compiling $sourcefile ... "
amxxpc $sourcefile -i"include" -o"$output_path"
done
- name: Move files
run: |
mkdir publish
mv cstrike/ publish/
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: MapManager-${{ env.SHA_SHORT }}-dev
path: publish/*

publish:
name: "Publish"
runs-on: ubuntu-latest
needs: [build]
if: |
github.event_name == 'release' &&
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: MapManager-${{needs.build.outputs.sha}}-dev

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

- name: Publish artifacts
uses: softprops/action-gh-release@v1
id: publish-job
if: |
startsWith(github.ref, 'refs/tags/') &&
steps.packaging.outcome == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
*.zip
16 changes: 16 additions & 0 deletions .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
pull_request:
types: [closed]

jobs:
update_release_draft:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
; Main plugins
map_manager_core.amxx
map_manager_scheduler.amxx

; Addons
map_manager_rtv.amxx
map_manager_nomination.amxx
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#endif
#define _map_manager_consts_included

#define VERSION_HASH ""

const MAPNAME_LENGTH = 32;

enum _:MapStruct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ new Array:g_aMapLists[MAX_MAPLISTS];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);
mapm_block_load_maplist();
}
public plugin_natives()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ new g_iMaxItems;

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

g_pCvars[BAN_LAST_MAPS] = register_cvar("mapm_blocklist_ban_last_maps", "10");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ new g_sPrefix[48];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

register_cvar("mapm_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ new const g_sSound[][] = {

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

g_pCvars[BLACK_SCREEN] = register_cvar("mapm_black_screen", "1"); // 0 - disable, 1 - enable
g_pCvars[BLOCK_CHAT] = register_cvar("mapm_block_chat", "1"); // 0 - disable, 1 - enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ new g_hForwards[Forwards];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

g_pCvars[CURSOR_SENS] = register_cvar("mapm_cursor_sens", "2.5");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ new g_sPrefix[48];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

register_clcmd("say timeleft", "clcmd_timeleft");
register_clcmd("say thetime", "clcmd_thetime");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ new g_szCurMap[32];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

g_pCvars[TYPE] = register_cvar("mapm_nom_type", "0"); // 0 - standart, 1 - fixed
g_pCvars[MAPS_IN_VOTE] = register_cvar("mapm_nom_maps_in_vote", "3");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ new Array:g_aMapsList;

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

g_pCvars[CHECK_NOMINATED_MAPS] = register_cvar("mapm_sort_check_nominated_maps", "0"); // 0 - disable, 1 - enable
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ new Array:g_aMapList;

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);
}

public mapm_maplist_loaded(Array:maplist, const nextmap[])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ new g_sPrefix[48];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

g_pCvars[MODE] = register_cvar("mapm_rtv_mode", "0"); // 0 - percents, 1 - players
g_pCvars[CHANGE_AFTER_VOTE] = register_cvar("mapm_rtv_change_after_vote", "0"); // 0 - disable, 1 - enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ new g_sCurMap[MAPNAME_LENGTH];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

g_pCvars[CHANGE_TYPE] = register_cvar("mapm_change_type", "1"); // 0 - after end vote, 1 - in round end, 2 - after end map
g_pCvars[TIMELEFT_TO_VOTE] = register_cvar("mapm_timeleft_to_vote", "2"); // minutes
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0c4bd4a

Please sign in to comment.