mirror of
https://github.com/gbdev/rgbds.git
synced 2026-05-08 10:59:36 +00:00
2502d130eb
MSBuild is slow, and its output is hard to parse visually (it's all interwoven, like Make without `--output-sync`). Since we use CMake anyway, we don't care about the build system.
121 lines
4.1 KiB
YAML
121 lines
4.1 KiB
YAML
name: Create release artifacts
|
|
on:
|
|
push:
|
|
tags:
|
|
- v[0-9]*
|
|
|
|
env:
|
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
|
TERM: xterm-256color
|
|
CLICOLOR: 1
|
|
CLICOLOR_FORCE: 1
|
|
|
|
CMAKE_COLOR_DIAGNOSTICS: ON # Tells CMake-generated build systems to have colored output.
|
|
# Approximate number of CPU cores in GitHub's runners as of 2026-03-18:
|
|
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories
|
|
CMAKE_BUILD_PARALLEL_LEVEL: 4 # `cmake --build` now implies `--parallel 4`.
|
|
CMAKE_INSTALL_PARALLEL_LEVEL: 4 # `cmake --install` now implies `--parallel 4`.
|
|
CMAKE_BUILD_TYPE: Release # `cmake -S` now implies `-DCMAKE_BUILD_TYPE=Release`.
|
|
CMAKE_CONFIG_TYPE: Release # `cmake --build` now implies `--config Release`.
|
|
|
|
# We instruct CMake to download and build third-party projects in the same place as in `testing.yml`
|
|
# to prevent divergence between testing and release workflows.
|
|
DEPS_ROOT_DIR: ~/_deps
|
|
|
|
jobs:
|
|
windows:
|
|
runs-on: windows-2022
|
|
strategy:
|
|
matrix:
|
|
bits: [32, 64]
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
- name: Install deps
|
|
run: |
|
|
bash .github/scripts/install_deps.sh windows
|
|
- name: Build Windows binaries
|
|
shell: cmd
|
|
run: |
|
|
call .github\scripts\msvc-env.bat ${{ matrix.bits }}
|
|
cmake -S . -B build -G Ninja -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}"
|
|
cmake --build build
|
|
- name: Package binaries
|
|
working-directory: build
|
|
run: |
|
|
cpack -DCPACK_PACKAGE_FILE_NAME=rgbds-win${{ matrix.bits }} -G ZIP --verbose
|
|
- name: Upload Windows binaries
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: win${{ matrix.bits }}
|
|
path: build/rgbds-win${{ matrix.bits }}.zip
|
|
if-no-files-found: error
|
|
|
|
macos:
|
|
runs-on: macos-26
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
- name: Install deps
|
|
run: |
|
|
./.github/scripts/install_deps.sh macos lld
|
|
- name: Build binaries
|
|
run: |
|
|
cmake -S . -B build --preset macos-static -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}"
|
|
cmake --build build -- --output-sync --keep-going
|
|
strip rgb{asm,link,fix,gfx}
|
|
env:
|
|
LDFLAGS: -fuse-ld=lld # cmake/macos-static.cmake comments explain why we use lld.
|
|
- name: Package binaries
|
|
run: |
|
|
zip --junk-paths rgbds-macos.zip rgb{asm,link,fix,gfx} man/* .github/scripts/install.sh
|
|
- name: Upload macOS binaries
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: macos
|
|
path: rgbds-macos.zip
|
|
if-no-files-found: error
|
|
|
|
linux:
|
|
runs-on: ubuntu-22.04 # Oldest supported, for best glibc compatibility.
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
- name: Install deps
|
|
run: |
|
|
./.github/scripts/install_deps.sh ubuntu-22.04
|
|
- name: Build binaries
|
|
run: |
|
|
make -kj WARNFLAGS="-Wall -Wextra -pedantic -static" PKG_CONFIG="pkg-config --static" Q=
|
|
strip rgb{asm,link,fix,gfx}
|
|
- name: Package binaries
|
|
run: |
|
|
tar caf rgbds-linux-x86_64.tar.xz --transform='s#.*/##' rgb{asm,link,fix,gfx} man/* .github/scripts/install.sh
|
|
- name: Upload Linux binaries
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: linux
|
|
path: rgbds-linux-x86_64.tar.xz
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
runs-on: ubuntu-slim
|
|
needs: [windows, macos, linux]
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
- name: Package sources
|
|
run: |
|
|
make dist Q=
|
|
- name: Download all binary packages
|
|
uses: actions/download-artifact@v8
|
|
- name: Draft the release
|
|
run: |
|
|
.github/scripts/draft-release.sh "${ref#refs/tags/}"
|
|
env:
|
|
ref: ${{ github.ref_name }}
|
|
GH_TOKEN: ${{ github.token }} # Required by the `gh` command.
|