Skip to content

Update deploy.yml

Update deploy.yml #21

Workflow file for this run

name: Create Release
on:
push:
branches: [ main ]
permissions:
contents: write
packages: write
deployments: write
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
build_type: [static, shared]
asio: [with_asio, no_asio]
include:
- os: windows-latest
platform: windows
- os: ubuntu-latest
platform: linux
- os: macos-latest
platform: macos
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Create build directory
run: cmake -E make_directory GekkoLib/build
- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
working-directory: GekkoLib
run: >-
cmake -B build
-DCMAKE_BUILD_TYPE=Release
-DBUILD_SHARED_LIBS=${{ matrix.build_type == 'shared' && 'ON' || 'OFF' }}
-DNO_ASIO_BUILD=${{ matrix.asio == 'no_asio' && 'ON' || 'OFF' }}
.
- name: Configure CMake (Unix)
if: matrix.os != 'windows-latest'
shell: bash
working-directory: GekkoLib
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=${{ matrix.build_type == 'shared' && 'ON' || 'OFF' }} \
-DNO_ASIO_BUILD=${{ matrix.asio == 'no_asio' && 'ON' || 'OFF' }} \
.
- name: Build
working-directory: GekkoLib
run: cmake --build build --config Release
- name: Prepare files for packaging
working-directory: GekkoLib
shell: bash
run: |
mkdir -p package/Release/${{ matrix.platform }}/lib
mkdir -p package/Release/${{ matrix.platform }}/include
cp -r include/* package/Release/${{ matrix.platform }}/include/ || true
if [ "${{ matrix.os }}" = "windows-latest" ]; then
# For Windows, check both build and build/Release directories
if [ -d build/Release ]; then
find build/Release -name "*.dll" -o -name "*.lib" -exec cp {} package/Release/${{ matrix.platform }}/lib/ \;
else
find build -name "*.dll" -o -name "*.lib" -exec cp {} package/Release/${{ matrix.platform }}/lib/ \;
fi
else
find build -name "*.so" -o -name "*.so.*" -o -name "*.a" -o -name "*.dylib" -exec cp {} package/Release/${{ matrix.platform }}/lib/ \;
fi
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}-builds-${{ matrix.build_type }}-${{ matrix.asio }}
path: GekkoLib/package/Release
retention-days: 1
create_release:
needs: build
runs-on: ubuntu-latest
if: ${{ success() }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: |
echo "version=$(date +'%Y.%m.%d')-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: downloads
- name: Create OS-specific packages
run: |
# Group by OS platform
for os_platform in windows linux macos; do
mkdir -p "GekkoNet-${os_platform}"
for build_variant in static-with_asio static-no_asio shared-with_asio shared-no_asio; do
cp -r downloads/${os_platform}-builds-${build_variant}/* "GekkoNet-${os_platform}/" || true
done
tar -czf "GekkoNet-${os_platform}-all-variants-Release.tar.gz" "GekkoNet-${os_platform}"
done
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: false
files: GekkoNet-*-all-variants-Release.tar.gz