mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-03-15 03:39:56 +01:00
Correctly set snapshot_id (acting as build number) for mods
Also refactor a bunch of variables and their handling in the workflow.
This commit is contained in:
parent
706be01044
commit
62af7504b2
27
.github/build.sh
vendored
27
.github/build.sh
vendored
@ -19,14 +19,14 @@ if [ -z "${STATIC_DYNAMIC-}" ]; then
|
||||
>&2 echo "STATIC_DYNAMIC not set (static, dynamic)"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${RELTYPECFG-}" ]; then
|
||||
>&2 echo "RELTYPECFG not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${RELNAME-}" ]; then
|
||||
>&2 echo "RELNAME not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${RELTYPE-}" ]; then
|
||||
>&2 echo "RELTYPE not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${MOD_ID-}" ]; then
|
||||
>&2 echo "MOD_ID not set"
|
||||
exit 1
|
||||
@ -76,14 +76,25 @@ fi
|
||||
if [ $PLATFORM_SHORT == "win" ]; then
|
||||
bin_suffix=$bin_suffix.exe
|
||||
fi
|
||||
if echo $RELTYPECFG | base64 -d | grep snapshot; then
|
||||
if [ "$RELTYPE" == "snapshot" ]; then
|
||||
other_flags+=$'\t-Dsnapshot=true\t-Dsnapshot_id='
|
||||
other_flags+=`echo $RELNAME | cut -d '-' -f 2`
|
||||
other_flags+=`echo $RELNAME | cut -d '-' -f 2` # $RELNAME is snapshot-X
|
||||
fi
|
||||
if echo $RELTYPECFG | base64 -d | grep snapshot || [ "$MOD_ID" != "0" ]; then
|
||||
if [ "$RELTYPE" == "snapshot" ] && [ "$MOD_ID" != "0" ]; then
|
||||
>&2 echo "mods and snapshots do not mix"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$RELTYPE" == "stable" ] && [ "$MOD_ID" != "0" ]; then
|
||||
other_flags+=$'\t-Dsnapshot_id='
|
||||
other_flags+=`echo $RELNAME | cut -d '.' -f 3` # $RELNAME is vX.Y.Z
|
||||
fi
|
||||
if [ "$RELTYPE" == "snapshot" ] || [ "$MOD_ID" != "0" ]; then
|
||||
other_flags+=$'\t-Dupdate_server=starcatcher.us/TPT'
|
||||
fi
|
||||
meson -Dbuildtype=release -Db_pie=false -Db_staticpic=false -Db_lto=true $static_flag -Dinstall_check=true $other_flags `echo $RELTYPECFG | base64 -d` build
|
||||
if [ "$RELTYPE" != "dev" ]; then
|
||||
other_flags+=$'\t-Dignore_updates=false'
|
||||
fi
|
||||
meson -Dbuildtype=release -Db_pie=false -Db_staticpic=false -Db_lto=true $static_flag -Dinstall_check=true $other_flags build
|
||||
cd build
|
||||
ninja
|
||||
if [ $PLATFORM_SHORT == "lin" ] || [ $PLATFORM_SHORT == "mac" ]; then
|
||||
|
3
.github/get-type.py
vendored
3
.github/get-type.py
vendored
@ -9,15 +9,12 @@ match_snapshot = re.match(r'refs/tags/snapshot-([0-9]+)', ref)
|
||||
if match_stable:
|
||||
print('::set-output name=TYPE::stable')
|
||||
print('::set-output name=NAME::v%s.%s.%s' % (match_stable.group(1), match_stable.group(2), match_stable.group(3)))
|
||||
print('::set-output name=RELTYPECFG::%s' % base64.b64encode(('-Dignore_updates=false').encode('utf-8')).decode('utf-8'))
|
||||
elif match_snapshot:
|
||||
print('::set-output name=TYPE::snapshot')
|
||||
print('::set-output name=NAME::snapshot-%s' % match_snapshot.group(1))
|
||||
print('::set-output name=RELTYPECFG::%s' % base64.b64encode(('-Dignore_updates=false\t-Dsnapshot=true\t-Dsnapshot_id=%s' % match_snapshot.group(1)).encode('utf-8')).decode('utf-8'))
|
||||
else:
|
||||
print('::set-output name=TYPE::dev')
|
||||
print('::set-output name=NAME::dev')
|
||||
print('::set-output name=RELTYPECFG::%s' % base64.b64encode(('-Dignore_updates=true').encode('utf-8')).decode('utf-8'))
|
||||
|
||||
with open('.github/mod_id.txt') as f:
|
||||
print('::set-output name=MOD_ID::' + f.read())
|
||||
|
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
@ -112,8 +112,8 @@ jobs:
|
||||
MACHINE_SHORT: ${{ matrix.machine_short }}
|
||||
TOOLSET_SHORT: ${{ matrix.toolset_short }}
|
||||
STATIC_DYNAMIC: ${{ matrix.static_dynamic }}
|
||||
RELTYPECFG: ${{ steps.get_type.outputs.RELTYPECFG }}
|
||||
RELNAME: ${{ steps.get_type.outputs.NAME }}
|
||||
RELTYPE: ${{ steps.get_type.outputs.TYPE }}
|
||||
MOD_ID: ${{ steps.get_type.outputs.MOD_ID }}
|
||||
- uses: actions/upload-release-asset@v1
|
||||
if: steps.get_type.outputs.TYPE != 'dev' && matrix.static_dynamic == 'static'
|
||||
|
Loading…
x
Reference in New Issue
Block a user