100 lines
3.6 KiB
YAML
100 lines
3.6 KiB
YAML
# https://github.com/openblack/bgfx.cmake/blob/master/.github/workflows/release.yml
|
|
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
|
|
version:
|
|
name: version
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
revision: ${{ steps.version.outputs.revision }}
|
|
sha: ${{ steps.version.outputs.sha }}
|
|
tag: ${{ steps.version.outputs.tag }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
- id: version
|
|
run: |
|
|
API_VERSION=$(grep -Eo "BGFX_API_VERSION UINT32_C\([0-9]+\)" bgfx/include/bgfx/defines.h | grep -Eo "[0-9]+" | tail -1)
|
|
REVISION=$(cd bgfx && git rev-list HEAD --count)
|
|
SHA=$(cd bgfx && git rev-parse HEAD)
|
|
SHA7="${GITHUB_SHA::7}"
|
|
TAG="v1.${API_VERSION}.${REVISION}-${SHA7}"
|
|
echo "::set-output name=revision::${REVISION}"
|
|
echo "::set-output name=sha::${SHA}"
|
|
echo "::set-output name=tag::${TAG}"
|
|
|
|
build:
|
|
name: ${{ matrix.os }}
|
|
needs: [ version ]
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
- os: ubuntu-latest
|
|
- os: macos-latest
|
|
|
|
env:
|
|
# Indicates the CMake build directory where project files and binaries are being produced.
|
|
CMAKE_BUILD_DIR: ${{ github.workspace }}/build/
|
|
CMAKE_INSTALL_DIR: ${{ github.workspace }}/install/
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
- name: Install Linux dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt install -y libgl1-mesa-dev
|
|
if: matrix.os == 'ubuntu-latest'
|
|
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
|
|
- uses: lukka/get-cmake@latest
|
|
|
|
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
|
|
- uses: ilammy/msvc-dev-cmd@v1
|
|
|
|
# Update version
|
|
- name: Update version.h
|
|
run: |
|
|
sed "s/ BGFX_REV_NUMBER .*/ BGFX_REV_NUMBER ${{ needs.version.outputs.revision }}/g" bgfx/src/version.h > version.tmp && mv version.tmp bgfx/src/version.h
|
|
sed "s/ BGFX_REV_SHA1 .*/ BGFX_REV_SHA1 \"${{ needs.version.outputs.sha }}\"/g" bgfx/src/version.h > version.tmp && mv version.tmp bgfx/src/version.h
|
|
shell: bash
|
|
|
|
# Run CMake to generate project files
|
|
- name: Generate project files
|
|
run: |
|
|
cmake -B "${{ env.CMAKE_BUILD_DIR }}" -DCMAKE_INSTALL_PREFIX="${{ env.CMAKE_INSTALL_DIR }}" -DCMAKE_DEBUG_POSTFIX=d -DBGFX_BUILD_EXAMPLES=OFF -DBGFX_BUILD_TOOLS=ON -DBGFX_INSTALL=ON -DBGFX_AMALGAMATED=ON -DCMAKE_BUILD_TYPE=Release
|
|
# Build the install targets
|
|
- name: Build
|
|
run: |
|
|
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target install --config Release
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.os }}
|
|
path: ${{ github.workspace }}/install/
|
|
|
|
release:
|
|
name: release
|
|
runs-on: ubuntu-latest
|
|
needs: [ version, build ]
|
|
if: github.repository == 'bkaradzic/bgfx.cmake' && github.event_name == 'push'
|
|
steps:
|
|
- name: Create Release
|
|
uses: actions/create-release@v1
|
|
with:
|
|
tag_name: ${{ needs.version.outputs.tag }}
|
|
release_name: ${{ needs.version.outputs.tag }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|