Skip to content

Commit f95e96a

Browse files
committed
Deployed plugins are versioned after their build number
1 parent 2804ef7 commit f95e96a

File tree

5 files changed

+49
-5
lines changed

5 files changed

+49
-5
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
builds
2+
# autoversion is generated by CI
3+
autoversion.inc

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ before_script:
3636
- python setup.py install --prefix=~/.local
3737

3838
- cd $TRAVIS_BUILD_DIR
39+
# Generate autoversion.inc
40+
- python generate_auto_version.py build-$TRAVIS_BUILD_NUMBER
3941

4042
script:
4143
- smbuilder --flags " -i=addons/sourcemod/scripting/include"

addons/sourcemod/scripting/include/influx/stocks_core.inc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
#include <msharedutil/arrayvec>
1010
#include <msharedutil/ents>
1111

12+
#tryinclude <influx/autoversion>
13+
1214

1315
#define INF_NAME "Influx"
1416
#define INF_AUTHOR "Mehis"
15-
#define INF_URL "http://influxtimer.com/"
16-
// If a plugin doesn't have the same version number, it may need a recompile.
17-
#define INF_VERSION "1.3"
18-
17+
#define INF_URL "https://influxtimer.com/"
18+
#if !defined INF_VERSION
19+
#define INF_VERSION "manual"
20+
#endif
1921

2022
#define INF_MAXPLAYERS MAXPLAYERS + 1
2123

deploy.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
echo "Deploying..."
44

5-
# Zip em and roll em into a tar ball
65
cd builds
6+
7+
# We don't want to include the auto version here.
8+
rm addons/sourcemod/scripting/include/influx/autoversion.inc
9+
10+
# Zip em and roll em into a tar ball
711
cd full && zip -rq9 ../full.zip . && cd ..
812
cd bhop && zip -rq9 ../bhop.zip . && cd ..
913
cd surf && zip -rq9 ../surf.zip . && cd ..

generate_auto_version.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
import sys
3+
4+
5+
REL_FILE_PATH = 'addons/sourcemod/scripting/include/influx/autoversion.inc'
6+
7+
8+
def write_to_file(file_path, version):
9+
if not os.path.isdir(os.path.dirname(file_path)):
10+
raise Exception('Failed to build path to autoversion file! (%s)' %
11+
file_path)
12+
13+
with open(file_path, 'w') as fp:
14+
fp.write("""
15+
#if defined _influx_autoversion_included
16+
#endinput
17+
#endif
18+
#define _influx_autoversion_included
19+
20+
#define INF_VERSION "%s"
21+
""" % version)
22+
23+
24+
def main():
25+
full_path = os.path.join(os.path.dirname(__file__), REL_FILE_PATH)
26+
27+
if len(sys.argv) < 2:
28+
raise Exception('No version string given!')
29+
30+
write_to_file(full_path, sys.argv[1])
31+
32+
33+
if __name__ == '__main__':
34+
main()

0 commit comments

Comments
 (0)