Skip to content

create-release-binaries #14

create-release-binaries

create-release-binaries #14

name: create-release-binaries
on:
release:
types:
- created
env:
BUILD_TYPE: Release
jobs:
build_and_publish:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
executable_path: /build/Recrypt
executable_name: Recrypt
os_name: linux
- os: macos-latest
executable_path: /build/Recrypt
executable_name: Recrypt
os_name: mac
extra_cmake_config_flags: -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" # universal. arm and intel
- os: windows-latest
executable_path: /build/Recrypt/Release
executable_name: Recrypt.exe
os_name: win
extra_cmake_config_flags: -DCMAKE_GENERATOR_PLATFORM=x64 # make sure it's x64
runs-on: ${{ matrix.os }}
permissions:
contents: write
env:
ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-${{ matrix.os_name }}
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{ matrix.extra_cmake_config_flags}}
- name: Build with CMake
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Create Archive
working-directory: ${{github.workspace}}${{ matrix.executable_path }}
run: tar -czf "$ARCHIVE_NAME".tar.gz ${{ matrix.executable_name }}
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} "$ARCHIVE_NAME".tar.gz