6944d95d5a
Also update some actions, and use my forks for the release ones.
143 lines
5.8 KiB
YAML
143 lines
5.8 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
tags:
|
|
- 'v*.*'
|
|
- 'snapshot-*'
|
|
- 'tptlibsdev-*'
|
|
pull_request:
|
|
branches:
|
|
- '*'
|
|
|
|
jobs:
|
|
prepare:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
do_release: ${{ steps.prepare.outputs.do_release }}
|
|
build_matrix: ${{ steps.prepare.outputs.build_matrix }}
|
|
publish_matrix: ${{ steps.prepare.outputs.publish_matrix }}
|
|
release_type: ${{ steps.prepare.outputs.release_type }}
|
|
release_name: ${{ steps.prepare.outputs.release_name }}
|
|
mod_id: ${{ steps.prepare.outputs.mod_id }}
|
|
do_publish: ${{ steps.prepare.outputs.do_publish }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.10'
|
|
- id: prepare
|
|
run: python ./.github/prepare.py
|
|
env:
|
|
PUBLISH_HOSTPORT: ${{ secrets.STARCATCHER_PUBLISH_HOSTPORT }}
|
|
GITHUB_REF: ${{ github.ref }}
|
|
- if: steps.prepare.outputs.do_release == 'yes'
|
|
id: create_release
|
|
uses: LBPHacker/create-release@v2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: ${{ steps.prepare.outputs.release_name }}
|
|
draft: true
|
|
prerelease: false
|
|
build:
|
|
runs-on: ${{ matrix.runs_on }}
|
|
needs: [prepare]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJSON(needs.prepare.outputs.build_matrix) }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.10'
|
|
- run: python -m pip install meson ninja
|
|
- if: matrix.bsh_build_platform == 'darwin'
|
|
run: brew install pkg-config coreutils binutils bash
|
|
- if: matrix.bsh_build_platform == 'darwin' && matrix.bsh_static_dynamic != 'static'
|
|
run: brew install luajit curl fftw zlib sdl2
|
|
- if: matrix.bsh_build_platform == 'linux' && matrix.bsh_host_libc == 'mingw'
|
|
run: sudo apt update && sudo apt install g++-mingw-w64-x86-64
|
|
- if: matrix.bsh_build_platform == 'linux' && matrix.bsh_static_dynamic != 'static'
|
|
run: sudo apt update && sudo apt install libluajit-5.1-dev libcurl4-openssl-dev libfftw3-dev zlib1g-dev libsdl2-dev
|
|
- if: matrix.bsh_build_platform == 'linux' && matrix.bsh_static_dynamic == 'static'
|
|
run: sudo apt update && sudo apt install libc6-dev libc6-dev-i386
|
|
- run: bash -c './.github/build.sh'
|
|
env:
|
|
BSH_HOST_ARCH: ${{ matrix.bsh_host_arch }}
|
|
BSH_HOST_PLATFORM: ${{ matrix.bsh_host_platform }}
|
|
BSH_HOST_LIBC: ${{ matrix.bsh_host_libc }}
|
|
BSH_STATIC_DYNAMIC: ${{ matrix.bsh_static_dynamic }}
|
|
BSH_BUILD_PLATFORM: ${{ matrix.bsh_build_platform }}
|
|
BSH_DEBUG_RELEASE: ${{ matrix.bsh_debug_release }}
|
|
RELEASE_NAME: ${{ needs.prepare.outputs.release_name }}
|
|
RELEASE_TYPE: ${{ needs.prepare.outputs.release_type }}
|
|
MOD_ID: ${{ needs.prepare.outputs.mod_id }}
|
|
ASSET_PATH: ${{ matrix.asset_path }}
|
|
DEBUG_ASSET_PATH: ${{ matrix.debug_asset_path }}
|
|
SEPARATE_DEBUG: ${{ matrix.separate_debug }}
|
|
- uses: LBPHacker/upload-release-asset@v2 # TODO-NTL: ship licenses
|
|
if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.prepare.outputs.release_upload_url }}
|
|
asset_path: build/${{ matrix.asset_path }}
|
|
asset_name: ${{ matrix.asset_name }}
|
|
asset_content_type: application/zip
|
|
- uses: LBPHacker/upload-release-asset@v2
|
|
if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' && matrix.separate_debug == 'yes'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.prepare.outputs.release_upload_url }}
|
|
asset_path: build/${{ matrix.debug_asset_path }}
|
|
asset_name: ${{ matrix.debug_asset_name }}
|
|
asset_content_type: application/zip
|
|
- uses: actions/upload-artifact@v3
|
|
if: matrix.artifact == 'yes'
|
|
with:
|
|
path: build/${{ matrix.asset_path }}
|
|
name: ${{ matrix.asset_name }}
|
|
- uses: actions/upload-artifact@v3
|
|
if: matrix.artifact == 'yes' && matrix.separate_debug == 'yes'
|
|
with:
|
|
path: build/${{ matrix.debug_asset_path }}
|
|
name: ${{ matrix.debug_asset_name }}
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
needs: [build, prepare]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJSON(needs.prepare.outputs.publish_matrix) }}
|
|
if: needs.prepare.outputs.do_publish == 'yes'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: ${{ matrix.asset_name }}
|
|
- run: mv ${{ matrix.asset_name }}/${{ matrix.asset_path }} ${{ matrix.starcatcher_name }}
|
|
- run: sudo apt update && sudo apt install lftp && bash -c './.github/starcatcher-publish.sh'
|
|
env:
|
|
PUBLISH_HOSTPORT: ${{ secrets.STARCATCHER_PUBLISH_HOSTPORT }}
|
|
PUBLISH_USERNAME: ${{ secrets.STARCATCHER_PUBLISH_USERNAME }}
|
|
PUBLISH_PASSWORD: ${{ secrets.STARCATCHER_PUBLISH_PASSWORD }}
|
|
PUBLISH_DIRECTORY: ${{ secrets.STARCATCHER_PUBLISH_DIRECTORY }}
|
|
PUBLISH_FILENAME: ${{ matrix.starcatcher_name }}
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: [build, publish, prepare]
|
|
if: needs.prepare.outputs.do_publish == 'yes'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- run: ./.github/starcatcher-release.sh
|
|
env:
|
|
RELEASE_NAME: ${{ needs.prepare.outputs.release_name }}
|
|
RELEASE_TYPE: ${{ needs.prepare.outputs.release_type }}
|
|
MOD_ID: ${{ needs.prepare.outputs.mod_id }}
|
|
GITHUB_SHA: ${{ github.sha }}
|