Merge pull request #38 from meshula/main #652
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- '**' | |
- 'examples/**' | |
- '.github/workflows/windows.yml' | |
pull_request: | |
paths: | |
- '**' | |
- 'examples/**' | |
- '.github/workflows/windows.yml' | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
permissions: | |
contents: write # for actions/upload-release-asset to upload release asset | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: | |
compiler: [mingw-w64, msvc16] | |
bits: [64] | |
include: | |
- compiler: mingw-w64 | |
bits: 64 | |
ARCH: "x86_64" | |
WINDRES_ARCH: pe-x86-64 | |
- compiler: msvc16 | |
bits: 64 | |
ARCH: "x86_64" | |
WINDRES_ARCH: pe-x86-64 | |
env: | |
RELEASE_NAME: RGFW-dev_win${{ matrix.bits }}_${{ matrix.compiler }} | |
GNUTARGET: default | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Setup Release Version | |
run: | | |
echo "RELEASE_NAME=RGFW-${{ github.event.release.tag_name }}_win${{ matrix.bits }}_${{ matrix.compiler }}" >> $GITHUB_ENV | |
shell: bash | |
if: github.event_name == 'release' && github.event.action == 'published' | |
- name: Setup Environment | |
run: | | |
dir | |
mkdir build | |
cd build | |
mkdir ${{ env.RELEASE_NAME }} | |
cd ${{ env.RELEASE_NAME }} | |
mkdir include | |
mkdir lib | |
cd ../../../RGFW | |
# Setup MSBuild.exe path if required | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
if: matrix.compiler == 'msvc16' | |
- name: Add msvc | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Build app for release | |
run: | | |
set "vs_path=%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" | |
- name: Build Library (MSVC16 64bit) | |
run: | | |
windres.exe --version | |
rm -f RGFW.o | |
make libRGFW.a CC=cl | |
make libRGFW.dll CC=cl | |
copy /Y .\libRGFW.dll .\build\${{ env.RELEASE_NAME }}\lib | |
shell: cmd | |
if: | | |
matrix.compiler == 'msvc16' && | |
matrix.bits == 64 | |
- name: Build Library (MinGW-w64 64bit) | |
run: | | |
${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version | |
windres.exe --version | |
dir C:\msys64\mingw64\bin | |
rm -f RGFW.o | |
make libRGFW.a | |
make libRGFW.dll | |
copy /Y .\libRGFW.dll .\build\${{ env.RELEASE_NAME }}\lib | |
shell: cmd | |
if: | | |
matrix.compiler == 'mingw-w64' && | |
matrix.bits == 64 | |
- name: Generate Artifacts | |
run: | | |
copy /Y .\RGFW.h .\build\${{ env.RELEASE_NAME }}\include | |
xcopy .\deps .\build\${{ env.RELEASE_NAME }}\include /E /I /Y | |
copy /Y .\libRGFW.a .\build\${{ env.RELEASE_NAME }}\lib | |
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md | |
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE | |
cd build | |
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }} | |
dir | |
shell: cmd | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.RELEASE_NAME }}.zip | |
path: ./build/${{ env.RELEASE_NAME }}.zip | |
- name: Upload Artifact to Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./build/${{ env.RELEASE_NAME }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event_name == 'release' && github.event.action == 'published' |