Skip to content

Commit

Permalink
Create release packages automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
eXpl0it3r committed May 19, 2024
1 parent 46ce194 commit b7cdb91
Show file tree
Hide file tree
Showing 2 changed files with 311 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [push, pull_request, workflow_dispatch]
on: workflow_dispatch

concurrency:
group: environment-${{github.ref}}
Expand Down
310 changes: 310 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,310 @@
name: Release Builds

on: [push, workflow_dispatch]

#on:
# push:
# branches:
# - master
# - 2.6.x
# tags:
# - "**"
# workflow_dispatch: {}

concurrency:
group: release-${{github.ref}}
cancel-in-progress: true

jobs:
windows:
name: Windows
runs-on: windows-2022

steps:
- name: Cache MinGW x86
id: mingw-x86-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/mingw32
key: 14.1.0posix-18.1.5-11.0.1-msvcrt-r1-x86

- name: Install MinGW x86
if: steps.mingw-x86-cache.outputs.cache-hit != 'true'
uses: bwoodsend/setup-winlibs-action@v1
id: winlibs-32
with:
tag: 14.1.0posix-18.1.5-11.0.1-msvcrt-r1
with_clang: false
architecture: 32
destination: ${{ github.workspace }}
add_to_path: false

- name: Cache MinGW x64
id: mingw-x64-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/mingw64
key: 14.1.0posix-18.1.5-11.0.1-msvcrt-r1-x64

- name: Install MinGW x64
if: steps.mingw-x64-cache.outputs.cache-hit != 'true'
uses: bwoodsend/setup-winlibs-action@v1
id: winlibs-64
with:
tag: 14.1.0posix-18.1.5-11.0.1-msvcrt-r1
with_clang: false
architecture: 64
destination: ${{ github.workspace }}
add_to_path: false

- name: Checkout SFML
uses: actions/checkout@v4
with:
repository: SFML/SFML
ref: 2.6.1
path: SFML

- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML

- name: Build SFML x86 with VS2022
run: |
cmake -S SFML -B SFML-build-x86 -A Win32 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_STATIC_STD_LIBS=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-x86 -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build-x86 --config Release --target install
- name: Build CSFML x86 with VS2022
run: |
cmake -S CSFML -B CSFML-build-x86 -A Win32 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=TRUE -DSTATIC_STD_LIBS=TRUE -DCSFML_LINK_SFML_STATICALLY=TRUE -DCMAKE_BUILD_TYPE=Release -DSFML_DIR=${{ github.workspace }}/SFML-x86/lib/cmake/SFML -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-x86 -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build-x86 --config Release --target install
- name: Add MinGW x86 to PATH
shell: bash
run: echo "${{ github.workspace }}\mingw32\bin" >> $GITHUB_PATH

- name: Generate Import Libs for x86 MinGW
shell: pwsh
run: |
New-Item -ItemType "directory" -PATH "CSFML-x86\lib\gcc"
New-Item -ItemType "directory" -PATH "CSFML-x86\lib\msvc"
Move-Item -Path "CSFML-x86\lib\*.lib" -Destination "CSFML-x86\lib\msvc"
Push-Location CSFML-x86\lib\gcc
& gendef.exe "..\..\bin\csfml-graphics-2.dll"
& dlltool.exe -d "csfml-graphics-2.def" -D "..\..\bin\csfml-graphics-2.dll" -l "libcsfml-graphics.a"
Remove-Item -Path "csfml-graphics-2.def"
& gendef.exe "..\..\bin\csfml-window-2.dll"
& dlltool.exe -d "csfml-window-2.def" -D "..\..\bin\bin\csfml-window-2.dll" -l "libcsfml-window.a"
Remove-Item -Path "csfml-window-2.def"
& gendef.exe "..\..\bin\csfml-audio-2.dll"
& dlltool.exe -d "csfml-audio-2.def" -D "..\..\bin\bin\csfml-audio-2.dll" -l "libcsfml-audio.a"
Remove-Item -Path "csfml-audio-2.def"
& gendef.exe "..\..\bin\csfml-network-2.dll"
& dlltool.exe -d "csfml-network-2.def" -D "..\..\bin\bin\csfml-network-2.dll" -l "libcsfml-network.a"
Remove-Item -Path "csfml-network-2.def"
& gendef.exe "..\..\bin\csfml-system-2.dll"
& dlltool.exe -d "csfml-system-2.def" -D "..\..\bin\bin\csfml-system-2.dll" -l "libcsfml-system.a"
Remove-Item -Path "csfml-system-2.def"
Pop-Location
- name: Upload Artifact x86
uses: actions/upload-artifact@v4
with:
name: CSFML-windows-32-bit
path: CSFML-x86

- name: Build SFML x64 with VS2022
run: |
cmake -S SFML -B SFML-build-x64 -A x64 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_STATIC_STD_LIBS=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-x64 -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build-x64 --config Release --target install
- name: Build CSFML x64 with VS2022
run: |
cmake -S CSFML -B CSFML-build-x64 -A x64 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=TRUE -DSTATIC_STD_LIBS=TRUE -DCSFML_LINK_SFML_STATICALLY=TRUE -DCMAKE_BUILD_TYPE=Release -DSFML_DIR=${{ github.workspace }}/SFML-x64/lib/cmake/SFML -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-x64 -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build-x64 --config Release --target install
- name: Add MinGW x64 to PATH
shell: bash
run: echo "${{ github.workspace }}\mingw64\bin" >> $GITHUB_PATH

- name: Generate Import Libs for x64 MinGW
shell: pwsh
run: |
New-Item -ItemType "directory" -PATH "CSFML-x64\lib\gcc"
New-Item -ItemType "directory" -PATH "CSFML-x64\lib\msvc"
Move-Item -Path "CSFML-x64\lib\*.lib" -Destination "CSFML-x64\lib\msvc"
Push-Location CSFML-x64\lib\gcc
& gendef.exe "..\..\bin\csfml-graphics-2.dll"
& dlltool.exe -d "csfml-graphics-2.def" -D "..\..\bin\csfml-graphics-2.dll" -l "libcsfml-graphics.a"
Remove-Item -Path "csfml-graphics-2.def"
& gendef.exe "..\..\bin\csfml-window-2.dll"
& dlltool.exe -d "csfml-window-2.def" -D "..\..\bin\bin\csfml-window-2.dll" -l "libcsfml-window.a"
Remove-Item -Path "csfml-window-2.def"
& gendef.exe "..\..\bin\csfml-audio-2.dll"
& dlltool.exe -d "csfml-audio-2.def" -D "..\..\bin\bin\csfml-audio-2.dll" -l "libcsfml-audio.a"
Remove-Item -Path "csfml-audio-2.def"
& gendef.exe "..\..\bin\csfml-network-2.dll"
& dlltool.exe -d "csfml-network-2.def" -D "..\..\bin\bin\csfml-network-2.dll" -l "libcsfml-network.a"
Remove-Item -Path "csfml-network-2.def"
& gendef.exe "..\..\bin\csfml-system-2.dll"
& dlltool.exe -d "csfml-system-2.def" -D "..\..\bin\bin\csfml-system-2.dll" -l "libcsfml-system.a"
Remove-Item -Path "csfml-system-2.def"
Pop-Location
- name: Upload Artifact x64
uses: actions/upload-artifact@v4
with:
name: CSFML-windows-64-bit
path: CSFML-x64

macos:
name: macOS
runs-on: macos-14

steps:
- name: Cache macOS SDK 10.15
id: macosx-10-15-sdk
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/MacOSX10.15.sdk
key: macosx-10-15-sdk

- name: Download macOS SDK 10.15
if: steps.macosx-10-15-sdk.outputs.cache-hit != 'true'
run: |
curl -Lo MacOSX10.15.sdk.tar.xz https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.15.sdk.tar.xz
tar -xvf MacOSX10.15.sdk.tar.xz
- name: Install macOS SDK 10.15
run: |
sudo mv MacOSX10.15.sdk /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
- name: Cache macOS SDK 11.0
id: macosx-11-0-sdk
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/MacOSX11.0.sdk
key: macosx-11-0-sdk

- name: Download macOS SDK 11.0
if: steps.macosx-11-0-sdk.outputs.cache-hit != 'true'
run: |
curl -Lo MacOSX11.0.sdk.tar.xz https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xvf MacOSX11.0.sdk.tar.xz
- name: Install macOS SDK 11.0
run: sudo mv MacOSX11.0.sdk /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

- name: Checkout SFML
uses: actions/checkout@v4
with:
repository: SFML/SFML
ref: 2.6.1
path: SFML

- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML

- name: Build SFML x64
run: |
cmake -S SFML -B SFML-build-x64 -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" \
-DCMAKE_CXX_COMPILER="/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++" \
-DBUILD_SHARED_LIBS=TRUE \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-x64/Library/Frameworks \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_SYSROOT=${{ github.workspace }}/MacOSX10.15.sdk \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DSFML_BUILD_FRAMEWORKS=TRUE \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build-x64 --config Release --target install
- name: Build CSFML x64
run: |
cmake -S CSFML -B CSFML-build-x64 -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" \
-DCMAKE_CXX_COMPILER="/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++" \
-DBUILD_SHARED_LIBS=TRUE \
-DSTATIC_STD_LIBS=FALSE \
-DCSFML_LINK_SFML_STATICALLY=FALSE \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-x64 \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_SYSROOT=${{ github.workspace }}/MacOSX10.15.sdk \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DSFML_DIR=${{ github.workspace }}/SFML-x64/Library/Frameworks/SFML.framework/Resources/CMake \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build-x64 --config Release --target install
- name: Create x64 Archive
run: |
mkdir CSFML-macOS-clang-64-bit
cp -R CSFML-x64/include CSFML-macOS-clang-64-bit
cp -R CSFML-x64/lib CSFML-macOS-clang-64-bit
cp CSFML-x64/share/CSFML/* CSFML-macOS-clang-64-bit
tar -zcvf CSFML-macOS-clang-64-bit.tar.gz CSFML-macOS-clang-64-bit
- name: Upload Artifact x64
uses: actions/upload-artifact@v4
with:
name: CSFML-macOS-clang-64-bit
path: CSFML-macOS-clang-64-bit.tar.gz

- name: Build SFML ARM64
run: |
cmake -S SFML -B SFML-build-arm64 -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" \
-DCMAKE_CXX_COMPILER="/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++" \
-DBUILD_SHARED_LIBS=TRUE \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-arm64/Library/Frameworks \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_SYSROOT=${{ github.workspace }}/MacOSX11.0.sdk \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DSFML_BUILD_FRAMEWORKS=TRUE \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build-arm64 --config Release --target install
- name: Build CSFML ARM64
run: |
cmake -S CSFML -B CSFML-build-arm64 -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" \
-DCMAKE_CXX_COMPILER="/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++" \
-DBUILD_SHARED_LIBS=TRUE \
-DSTATIC_STD_LIBS=FALSE \
-DCSFML_LINK_SFML_STATICALLY=FALSE \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-arm64 \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_SYSROOT=${{ github.workspace }}/MacOSX11.0.sdk \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DSFML_DIR=${{ github.workspace }}/SFML-arm64/Library/Frameworks/SFML.framework/Resources/CMake \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build-arm64 --config Release --target install
- name: Create ARM64 Archive
run: |
mkdir CSFML-macOS-clang-arm64
cp -R CSFML-arm64/include CSFML-macOS-clang-arm64
cp -R CSFML-arm64/lib CSFML-macOS-clang-arm64
cp CSFML-arm64/share/CSFML/* CSFML-macOS-clang-arm64
tar -zcvf CSFML-macOS-clang-arm64.tar.gz CSFML-macOS-clang-arm64
- name: Upload Artifact ARM64
uses: actions/upload-artifact@v4
with:
name: CSFML-macOS-clang-arm64
path: CSFML-macOS-clang-arm64.tar.gz

0 comments on commit b7cdb91

Please sign in to comment.