162 lines
4.1 KiB
YAML
162 lines
4.1 KiB
YAML
# SPDX-FileCopyrightText: 2025 William Bell
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
name: Build and Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*' # Any tag
|
|
|
|
jobs:
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install build tools
|
|
run: sudo apt-get update && sudo apt-get install -y flex bison
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Install Conan
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install conan
|
|
conan profile detect
|
|
|
|
- name: Build
|
|
run: |
|
|
conan install . --build=missing
|
|
conan build .
|
|
|
|
- name: Package
|
|
run: |
|
|
TAG=${GITHUB_REF##refs/tags/}
|
|
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
ARCH=$(uname -m)
|
|
FOLDER="chloride-$TAG-$OS-$ARCH"
|
|
TAR="$FOLDER.tar.gz"
|
|
mv build/bin "$FOLDER"
|
|
cp LICENSE.txt "$FOLDER"
|
|
tar -czf "$TAR" "$FOLDER"
|
|
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: linux-artifact
|
|
path: ${{ env.TAR_NAME }}
|
|
|
|
build-macos:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install build tools
|
|
run: brew install flex bison
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Install Conan
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install conan
|
|
conan profile detect
|
|
|
|
- name: Build
|
|
run: |
|
|
conan install . --build=missing
|
|
conan build .
|
|
|
|
- name: Package
|
|
run: |
|
|
TAG=${GITHUB_REF##refs/tags/}
|
|
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
ARCH=$(uname -m)
|
|
FOLDER="chloride-$TAG-$OS-$ARCH"
|
|
TAR="$FOLDER.tar.gz"
|
|
mv build/bin "$FOLDER"
|
|
cp LICENSE.txt "$FOLDER"
|
|
tar -czf "$TAR" "$FOLDER"
|
|
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: macos-artifact
|
|
path: ${{ env.TAR_NAME }}
|
|
|
|
build-windows:
|
|
runs-on: windows-latest
|
|
defaults:
|
|
run:
|
|
shell: msys2 {0}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: MINGW64
|
|
update: true
|
|
install: >
|
|
base-devel
|
|
mingw-w64-x86_64-gcc
|
|
mingw-w64-x86_64-make
|
|
mingw-w64-x86_64-gmp
|
|
mingw-w64-x86_64-gc
|
|
|
|
- name: Build Project
|
|
run: |
|
|
make windows
|
|
|
|
- name: Package
|
|
run: |
|
|
$TAG = $env:GITHUB_REF -replace 'refs/tags/', ''
|
|
$ARCH = if ([Environment]::Is64BitOperatingSystem) { 'x64' } else { 'x86' }
|
|
$FOLDER = "chloride-$TAG-windows-$ARCH"
|
|
$ZIP = "$FOLDER.zip"
|
|
Rename-Item bin $FOLDER
|
|
Copy-Item LICENSE.txt $FOLDER
|
|
Compress-Archive -Path $FOLDER -DestinationPath $ZIP
|
|
echo "TAR_NAME=$ZIP" >> $env:GITHUB_ENV
|
|
shell: pwsh
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: windows-artifact
|
|
path: ${{ env.TAR_NAME }}
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: [build-linux, build-macos, build-windows]
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: ./artifacts
|
|
|
|
- name: Create GitHub Release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
tag: ${{ github.ref_name }}
|
|
name: Release ${{ github.ref_name }}
|
|
body: Automated release based on tag ${{ github.ref_name }}
|
|
draft: false
|
|
prerelease: ${{ startsWith(github.ref_name, 'prerelease-') }}
|
|
artifacts: "./artifacts/*" |