# 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 steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Install build tools run: choco install winflexbison -y shell: pwsh - 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 shell: pwsh - name: Build with MinGW run: | conan install . conan build . shell: pwsh - 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 build\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/*"