Workflow file for this run
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 & Release Precompiled Binaries | |
'on': | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build-ubuntu: | |
runs-on: ubuntu-latest | |
name: Build for Ubuntu | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Compile C++ sources | |
shell: bash | |
run: > | |
mkdir Release/ | |
tag=${{ github.ref_name }} | |
g++ -O3 -DNDEBUG -DVERSION=$tag -flto -fno-rtti -std=gnu++17 -o "Release/trilangle-${tag}-ubuntu" | |
src/*.cpp | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: trilangle-ubuntu | |
path: Release/ | |
build-mac: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
arch: | |
- x86_64 | |
- aarch64 | |
name: Build for macOS ${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Compile C++ sources | |
shell: bash | |
run: > | |
mkdir Release/ | |
tag=${{ github.ref_name }} | |
clang++ -O3 -DNDEBUG -DVERSION=$tag -flto -fno-rtti -std=gnu++20 -target "$(clang -dumpmachine | sed -E | |
's/^\w+-/${{ matrix.arch }}-/')" -o "Release/trilangle-${tag}-macos-${{ matrix.arch }}" src/*.cpp | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: trilangle-macos-${{ matrix.arch }} | |
path: Release/ | |
build-windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
include: | |
# Native compilation only uses the one. Cross compilation is in the form ${HOST}_${TARGET}. | |
# All GH-hosted runners are x86_64, which MSVC calls amd64 because of course it does. | |
- cmd_arch: amd64 | |
disp_arch: x86_64 | |
- cmd_arch: amd64_x86 | |
disp_arch: x86 | |
- cmd_arch: amd64_arm64 | |
disp_arch: arm64 | |
name: Build for Windows ${{ matrix.disp_arch }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ilammy/msvc-dev-cmd@v1.13.0 | |
with: | |
arch: ${{ matrix.cmd_arch }} | |
- name: Compile C++ sources | |
shell: cmd | |
run: > | |
MD Release | |
SET tag=${{ github.ref_name }} | |
cl .\src\*.cpp /O2 /EHsc /GL /GR- /DNDEBUG /DVERSION=%tag% /std:c++20 /MT /link | |
/out:Release\trilangle-%tag%-windows-${{ matrix.disp_arch }}.exe | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: trilangle-windows-${{ matrix.disp_arch }} | |
path: Release/ | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: | |
- build-ubuntu | |
- build-mac | |
- build-windows | |
steps: | |
- uses: actions/checkout@v4 | |
- run: "mkdir artifacts/\n" | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
- name: Flatten artifacts directory | |
# https://unix.stackexchange.com/a/52836 | |
run: | | |
find artifacts -type f -exec sh -c 'mv "$@" artifacts' _ {} + | |
find artifacts -depth -exec rmdir {} + || true | |
- name: Parse changelog | |
shell: bash | |
run: | | |
tag=${{ github.ref_name }} | |
sed -n "s/^## \[${tag//./\\.}\].*$//m | |
t loop | |
d | |
:loop | |
n | |
/^## /q | |
p | |
b loop" CHANGELOG.md >$tag-CHANGELOG.md | |
- uses: softprops/action-gh-release@v2 | |
with: | |
body_path: ${{ github.ref_name }}-CHANGELOG.md | |
files: artifacts/* |