Separate build and upload jobs on native #2
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 for various platforms and upload to itch.io | |
on: | |
push: | |
branches: [build] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build for ${{matrix.config.fancy_name}} | |
runs-on: ${{matrix.config.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: linux-gnu, | |
fancy_name: Linux (GCC), | |
exe: CodenamePedestrian, | |
out: CodenamePedestrian, | |
os: ubuntu-latest, | |
cxx: g++, | |
cc: gcc, | |
} | |
- { | |
name: windows-msvc, | |
fancy_name: Windows (MSVC), | |
exe: Debug/CodenamePedestrian.exe, | |
out: CodenamePedestrian.exe, | |
os: windows-latest, | |
cxx: cl, | |
cc: cl, | |
} | |
steps: | |
- name: Install dependencies (Ubuntu) | |
if: matrix.config.os == 'ubuntu-latest' | |
run: | | |
sudo apt update | |
sudo apt install cmake gcc g++ libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libgl-dev | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure CMake with selected compiler family | |
run: cmake -B build -S ${{github.workspace}} -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{matrix.config.cc}} -DCMAKE_CXX_COMPILER=${{matrix.config.cxx}} | |
- name: Build with CMake | |
run: cmake --build build -j 4 | |
- name: Assemble dist-files | |
run: | | |
mkdir -p dist | |
cp -r assets dist-${{matrix.config.name}} | |
cp build/${{matrix.config.exe}} dist-${{matrix.config.name}}/${{matrix.config.out}} | |
- name: Tar the distribution | |
run: tar -cvf ${{matrix.config.name}}.tar dist-${{matrix.config.name}} | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{matrix.config.fancy_name}} | |
path: ${{matrix.config.name}}.tar | |
upload: | |
name: Upload channel ${{matrix.distribution}} to itch.io | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
distribution: [linux-gnu, windows-msvc] | |
steps: | |
- name: Upload to itch.io | |
uses: manleydev/butler-publish-itchio-action@master | |
env: | |
BUTLER_CREDENTIALS: ${{ secrets.BUTLER_CREDENTIALS }} | |
CHANNEL: ${{matrix.distribution}} | |
ITCH_GAME: codename-pedestrian | |
ITCH_USER: nonk123 | |
PACKAGE: dist-${{matrix.distribution}} |