Skip to content

add source tar.gz as release asset #28

add source tar.gz as release asset

add source tar.gz as release asset #28

# This starter workflow is for a CMake project running on multiple platforms.
name: CMake on multiple platforms
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
# Consider changing this to true when your workflow is stable.
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
build_type: [Release]
c_compiler: [gcc, clang, cl]
include:
# Linux x86_64
- os: ubuntu
runner: ubuntu-latest
arch: x86_64
c_compiler: gcc
cpp_compiler: g++
# Windows x86_64
- os: windows
runner: windows-latest
arch: x86_64
c_compiler: cl
cpp_compiler: cl
# macOS Intel
- os: macos
runner: macos-13 # x86_64
arch: x86_64
c_compiler: clang
cpp_compiler: clang++
# macOS Apple Silicon
- os: macos
runner: macos-14 # arm64
arch: arm64
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows
c_compiler: gcc
- os: windows
c_compiler: clang
- os: ubuntu
c_compiler: cl
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
build-essential \
libasound2-dev \
libjack-jackd2-dev \
libfltk1.3-dev \
gettext
- name: Setup vcpkg with cache
if: runner.os == 'Windows'
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: ${{ github.workspace }}/vcpkg
vcpkgArgs: install
cache: true
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DARCH=${{ matrix.arch }}
-S ${{ github.workspace }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}
release:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Download source tar.gz
uses: actions/download-artifact@v4
with:
path: ./release
pattern: FreeMajor-1.0.1*
- name: Create/Update GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: automatic
prerelease: true
files: |
release/FreeMajor-1.0.1-Source.tar.gz
release/**/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}