CI/CD Release Improvements

This commit is contained in:
Hugues Ross 2021-07-24 16:59:18 +00:00
parent aae413601f
commit 895655aab5
8 changed files with 90 additions and 4 deletions

12
.cdb.json.template Normal file
View File

@ -0,0 +1,12 @@
{
"type": "MOD",
"title": "RPG16",
SHORT_DESCRIPTION
"tags": [ "16px" ],
"media_license": "CC BY-SA 4.0",
"repo": "https://gitlab.com/Df458/rpg16",
"website": "https://www.huguesross.net",
"issue_tracker": "https://gitlab.com/Df458/rpg16/issues",
"forums": 22890,
LONG_DESCRIPTION
}

View File

@ -1,12 +1,12 @@
stages:
- build
- stamp
- package
variables:
EXPORT_DIR: "rpg16"
before_script:
- apt-get -qq update && apt-get -qq install -y graphicsmagick rsync
- apt-get -qq update && apt-get -qq install -y graphicsmagick rsync optipng
build-textures:
stage: build
@ -18,7 +18,7 @@ build-textures:
- "rpg16/"
stamp:
stage: stamp
stage: package
only:
- tags
script:
@ -29,3 +29,16 @@ stamp:
- "rpg16/"
dependencies:
- build-textures
optimize:
stage: package
only:
- tags
script:
- "find ${EXPORT_DIR} -name '*.png' | xargs optipng -o5 -fix"
artifacts:
paths:
- "rpg16/"
dependencies:
- build-textures

View File

@ -1,5 +1,5 @@
# RPG16
A simple texturepack reminiscent of classic RPGs. Currently supports 'Minetest Game' and 'Capture the Flag'.
A simple texturepack reminiscent of classic RPGs
Created by [Hugues Alexandre Ross](https://huguesross.net)
## Game Support

16
cdb_json.awk Normal file
View File

@ -0,0 +1,16 @@
BEGIN {
short_description = ENVIRON["SHORT_DESCRIPTION"];
long_description = ENVIRON["LONG_DESCRIPTION"];
}
/^SHORT_DESCRIPTION/ {
print " \"short_description\": \"" short_description "\"";
}
/^LONG_DESCRIPTION/ {
print " \"long_description\": \"" long_description "\"";
}
!/DESCRIPTION/ {
print;
}

22
long_description.awk Normal file
View File

@ -0,0 +1,22 @@
BEGIN {
header_count = 0;
long_description = "";
}
/^#/ {
header_count++;
}
{
if (header_count > 1 && header_count < 5) {
if (long_description == "") {
long_description = $0;
} else {
long_description = long_description "\\n" $0;
}
}
}
END {
print long_description;
}

15
short_description.awk Normal file
View File

@ -0,0 +1,15 @@
BEGIN {
header_count = 0;
line_count = 0;
}
/^#/ {
header_count++;
}
!/^#/ {
if (header_count == 1 && line_count == 0) {
print;
line_count++;
}
}

View File

@ -22,3 +22,10 @@ convert "${EXPORT_DIR}/screenshot.png" \
# Stamp the provided version number into the texture_pack.conf
echo "release = ${1}" >> "${EXPORT_DIR}/texture_pack.conf"
# TODO: Optipng pass
# Generate an escaped long description for .cdb.json
export SHORT_DESCRIPTION=`awk -f "short_description.awk" "README.md"`
export LONG_DESCRIPTION=`awk -f "long_description.awk" "README.md"`
awk -f "cdb_json.awk" ".cdb.json.template" > "${EXPORT_DIR}/.cdb.json"

View File

@ -2,3 +2,4 @@ title = RPG16
name = rpg16
author = Hugues Ross
description = 16px - A simple texturepack reminiscent of classic RPGs. Currently supports Minetest Game.
min_minetest_version = 5.3