diff --git a/.github/build.sh b/.github/build.sh index a6360fdc1..a762d4203 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -23,6 +23,14 @@ 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 "${MOD_ID-}" ]; then + >&2 echo "MOD_ID not set" + exit 1 +fi if [ -z "${build_sh_init-}" ]; then if [ $PLATFORM_SHORT == "win" ]; then @@ -46,7 +54,8 @@ BUILD_INIT_BAT exit 0 fi -other_flags= +other_flags=$'\t-Dmod_id=' +other_flags+=$MOD_ID bin_suffix= static_flag= if [ $STATIC_DYNAMIC == "static" ]; then @@ -68,6 +77,10 @@ if [ $PLATFORM_SHORT == "win" ]; then bin_suffix=$bin_suffix.exe fi if echo $RELTYPECFG | base64 -d | grep snapshot; then + other_flags+=$'\t-Dsnapshot=true\t-Dsnapshot_id=' + other_flags+=`echo $RELNAME | cut -d '-' -f 2` +fi +if echo $RELTYPECFG | base64 -d | grep 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 diff --git a/.github/get-type.py b/.github/get-type.py index b763c5ae6..3f5742772 100644 --- a/.github/get-type.py +++ b/.github/get-type.py @@ -18,3 +18,6 @@ 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()) diff --git a/.github/mod_id.txt b/.github/mod_id.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/.github/mod_id.txt @@ -0,0 +1 @@ +0 diff --git a/.github/starcatcher-publish.sh b/.github/starcatcher-publish.sh new file mode 100755 index 000000000..59c61313c --- /dev/null +++ b/.github/starcatcher-publish.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cd "$STARCATCHER_PUBLISH_FILENAME" +mv "$1" "$STARCATCHER_PUBLISH_FILENAME" +LFTP_PASSWORD=$STARCATCHER_PUBLISH_PASSWORD lftp -c "open --user '$STARCATCHER_PUBLISH_USERNAME' --env-password -e 'set ftp:ssl-protect-data true; set ssl:verify-certificate false; put \"$STARCATCHER_PUBLISH_FILENAME\";' ftp://$STARCATCHER_PUBLISH_HOSTPORT" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 53feebff8..d2907c28e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -49,6 +49,10 @@ jobs: # mingw-dynamic | NO | NO | NO | NO | NO | NO | # # [1] I don't currently care enough about mingw to figure out how to do this. +# Please keep this matrix in sync with the other one in this file, see the ### blocks. +######################################################### +############# BEGIN BLOCK FOR COPYING BELOW ############# +######################################################### platform_short: [lin, mac, win] toolset_short: [gcc, msvc, mingw] machine_short: [x86_64, i686] @@ -65,6 +69,9 @@ jobs: platform_short: mac - toolset_short: gcc platform_short: win +######################################################### +############## END BLOCK FOR COPYING BELOW ############## +######################################################### include: - platform_short: lin os: ubuntu-latest @@ -93,7 +100,7 @@ jobs: - if: matrix.platform_short == 'lin' && matrix.static_dynamic != 'static' run: sudo apt update && sudo apt install libluajit-5.1-dev libcurl4-openssl-dev libfftw3-dev zlib1g-dev libsdl2-dev - run: python -m pip install meson ninja - - run: bash -c 'PLATFORM_SHORT=${{ matrix.platform_short }} MACHINE_SHORT=${{ matrix.machine_short }} TOOLSET_SHORT=${{ matrix.toolset_short }} STATIC_DYNAMIC=${{ matrix.static_dynamic }} RELTYPECFG=${{ steps.get_type.outputs.RELTYPECFG }} ./.github/build.sh' + - run: bash -c 'PLATFORM_SHORT=${{ matrix.platform_short }} 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 }} MOD_ID=${{ steps.get_type.outputs.MOD_ID }} ./.github/build.sh' - uses: actions/upload-release-asset@v1 if: steps.get_type.outputs.TYPE != 'dev' && matrix.static_dynamic == 'static' env: @@ -104,7 +111,64 @@ jobs: asset_name: powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }} asset_content_type: application/zip - uses: actions/upload-artifact@v2 - if: steps.get_type.outputs.TYPE == 'dev' && matrix.static_dynamic == 'static' + if: matrix.static_dynamic == 'static' with: path: powder${{ matrix.suffix }} name: powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }} + starcatcher-upload: + runs-on: ubuntu-latest + needs: [build] + if: startsWith(github.ref, 'refs/tags/') # not a perfect match but get-type.py takes care of this in job build + strategy: + matrix: +######################################################### +############# BEGIN BLOCK COPIED FROM ABOVE ############# +######################################################### + platform_short: [lin, mac, win] + toolset_short: [gcc, msvc, mingw] + machine_short: [x86_64, i686] + static_dynamic: [static, dynamic] + exclude: + - toolset_short: mingw + - machine_short: i686 + platform_short: lin + - machine_short: i686 + platform_short: mac + - toolset_short: msvc + platform_short: lin + - toolset_short: msvc + platform_short: mac + - toolset_short: gcc + platform_short: win +######################################################### +############## END BLOCK COPIED FROM ABOVE ############## +######################################################### + - static_dynamic: dynamic + include: + - platform_short: lin + suffix: '' + - platform_short: mac + suffix: '' + - platform_short: win + suffix: '.exe' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - id: get_type + run: python ./.github/get-type.py ${{ github.ref }} + - uses: actions/download-artifact@v1 + with: + name: powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }} + - run: sudo apt update && sudo apt install lftp + - if: steps.get_type.outputs.TYPE != 'dev' && matrix.static_dynamic == 'static' + run: bash -c 'STARCATCHER_PUBLISH_HOSTPORT=${{ secrets.STARCATCHER_PUBLISH_HOSTPORT }} STARCATCHER_PUBLISH_USERNAME=${{ secrets.STARCATCHER_PUBLISH_USERNAME }} STARCATCHER_PUBLISH_PASSWORD=${{ secrets.STARCATCHER_PUBLISH_PASSWORD }} STARCATCHER_PUBLISH_FILENAME=powder-${{ steps.get_type.outputs.NAME }}-${{ matrix.machine_short }}-${{ matrix.platform_short }}-${{ matrix.toolset_short }}-${{ matrix.static_dynamic }}${{ matrix.suffix }} ./.github/starcatcher-publish.sh powder${{ matrix.suffix }}' + starcatcher-release: + runs-on: ubuntu-latest + needs: [starcatcher-upload] + if: startsWith(github.ref, 'refs/tags/') # not a perfect match but get-type.py takes care of this in job build + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - id: get_type + run: python ./.github/get-type.py ${{ github.ref }} + - run: curl "https://starcatcher.us/TPT/perform-release.lua?mod=${{ steps.get_type.outputs.MOD_ID }}&type=${{ steps.get_type.outputs.TYPE }}&name=${{ steps.get_type.outputs.NAME }}"