Release only on push. #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build with CMake and Ninja | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Setup LLVM (Ubuntu) | |
if: runner.os == 'Linux' | |
run: | | |
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20230614/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64.tar.xz | |
tar xf llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64.tar.xz | |
echo "$(pwd)/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin" >> $GITHUB_PATH | |
- name: Install Dependencies (Ubuntu) | |
if: runner.os == 'Linux' | |
run: sudo apt-get install ninja-build xorg-dev libglu1-mesa-dev libxrandr-dev libxi-dev libxinerama-dev libxcursor-dev libxxf86vm-dev | |
- name: Install Ninja (Windows) | |
if: runner.os == 'Windows' | |
run: choco install ninja | |
- name: Install Ninja (macOS) | |
if: runner.os == 'macOS' | |
run: brew install ninja | |
- name: Create Build Directory | |
run: mkdir build | |
- name: Run CMake | |
run: | | |
cd build | |
cmake .. -GNinja | |
- name: Run Ninja | |
run: | | |
cd build | |
ninja | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-bin-${{ runner.os }} | |
path: build/bin/ | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: release-${{ github.sha }} | |
release_name: Release-${{ github.repository }}-${{ github.run_id }} | |
draft: false | |
prerelease: false | |
if: github.event_name == 'push' # Only run this step for push events | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./build/bin/ | |
asset_name: build-bin-${{ runner.os }} | |
asset_content_type: application/octet-stream | |
if: github.event_name == 'push' # Only run this step for push events |