CI #137
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: CI | |
# Controls when the workflow will run | |
on: | |
create: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
ReleaseType: | |
description: 'Release or Debug' | |
required: true | |
default: 'Release' | |
jobs: | |
Build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Submodules | |
run: git submodule update --init --recursive | |
- name: Setup .NET | |
if: matrix.os == 'windows-latest' | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.0.x | |
- name: Build source package | |
if: matrix.os == 'windows-latest' | |
run: dotnet pack -c Release ImGui.NET.SourceBuild.csproj | |
shell: bash | |
- name: Upload source package | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
name: win-x64 | |
path: bin\Packages\Release\*.nupkg | |
- name: Publish untagged source package to MyGet | |
if: matrix.os == 'windows-latest' && github.ref == 'refs/heads/master' | |
run: dotnet nuget push bin\Packages\Release\*.nupkg -s https://www.myget.org/F/mellinoe/api/v3/index.json --api-key ${{secrets.MYGET_KEY}} | |
- name: Publish tagged source package release to nuget.org | |
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/') | |
run: dotnet nuget push bin\Packages\Release\*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_KEY}} | |
- name: Build ${{ github.event.inputs.ReleaseType || 'Release' }} | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
./ci-build.cmd ${{ github.event.inputs.ReleaseType || 'Release' }} | |
else | |
./ci-build.sh ${{ github.event.inputs.ReleaseType || 'Release' }} | |
fi | |
shell: bash | |
- name: Upload win-x64 ${{ github.event.inputs.ReleaseType || 'Release' }} | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
name: win-x64 | |
path: cimgui\build\x64\${{ github.event.inputs.ReleaseType || 'Release' }}\* | |
- name: Upload win-x86 ${{ github.event.inputs.ReleaseType || 'Release' }} | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
name: win-x86 | |
path: cimgui\build\x86\${{ github.event.inputs.ReleaseType || 'Release' }}\* | |
- name: Upload win-arm ${{ github.event.inputs.ReleaseType || 'Release' }} | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
name: win-arm | |
path: cimgui\build\ARM\${{ github.event.inputs.ReleaseType || 'Release' }}\* | |
- name: Upload win-arm64 ${{ github.event.inputs.ReleaseType || 'Release' }} | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
name: win-arm64 | |
path: cimgui\build\ARM64\${{ github.event.inputs.ReleaseType || 'Release' }}\* | |
- name: Upload Linux ${{ github.event.inputs.ReleaseType || 'Release' }} | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
name: linux-x64 | |
path: cimgui/build/${{ github.event.inputs.ReleaseType || 'Release' }}/* | |
- name: Upload MacOS ${{ github.event.inputs.ReleaseType || 'Release' }} | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'macos-latest' | |
with: | |
name: osx-x64 | |
path: cimgui/build/${{ github.event.inputs.ReleaseType || 'Release' }}/* | |
- name: Upload Definitions Json File | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
name: JsonFiles | |
path: cimgui\generator\output\definitions.json | |
- name: Upload structs_and_enums Json File | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
name: JsonFiles | |
path: cimgui\generator\output\structs_and_enums.json | |
CreateReleaseOnTagCreate: | |
runs-on: ubuntu-latest | |
needs: [Build] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
- name: Rename win-x64 and win-x86 artifacts | |
run: | | |
mv win-x64/cimgui.dll win-x64/cimgui.win-x64.dll | |
mv win-x86/cimgui.dll win-x86/cimgui.win-x86.dll | |
mv win-arm64/cimgui.dll win-arm64/cimgui.win-arm64.dll | |
mv win-arm/cimgui.dll win-arm/cimgui.win-arm.dll | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
win-x64/cimgui.win-x64.dll | |
win-x86/cimgui.win-x86.dll | |
win-arm64/cimgui.win-arm64.dll | |
win-arm/cimgui.win-arm.dll | |
JsonFiles/* | |
linux-x64/cimgui.so | |
osx-x64/cimgui.dylib |