Skip to content

Update build.yml

Update build.yml #131

Workflow file for this run

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:
include:
- os: macos-latest
- os: ubuntu-latest
- os: windows-latest
architecture: x64
- os: windows-latest
architecture: x86
- os: windows-latest
architecture: ARM64
- os: windows-latest
architecture: ARM
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup .NET
if: matrix.os == 'windows-latest'
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Build source package
if: matrix.os == 'windows-latest' && matrix.architecture == 'x64'
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' && matrix.architecture == 'x64'
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' && matrix.architecture == 'x64'
run: dotnet nuget push bin\Packages\Release\*.nupkg -s https://www.myget.org/F/mellinoe/api/v3/index.json --api-key ${{secrets.MYGET_KEY}}
# error can be fixed afterwards and job can be re-triggered
continue-on-error: true
- name: Publish tagged source package release to nuget.org
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/') && matrix.architecture == 'x64'
run: dotnet nuget push bin\Packages\Release\*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_KEY}}
# error can be fixed afterwards and job can be re-triggered
continue-on-error: true
- name: Build ${{ github.event.inputs.ReleaseType || 'Release' }}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./ci-build.cmd ${{ github.event.inputs.ReleaseType || 'Release' }} ${{ matrix.architecture }}
else
./ci-build.sh ${{ github.event.inputs.ReleaseType || 'Release' }}
fi
shell: bash
- name: Upload win-${{ matrix.architecture }} ${{ github.event.inputs.ReleaseType || 'Release' }}
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: win-${{ matrix.architecture }}
path: cimgui\build\${{ matrix.architecture }}\${{ github.event.inputs.ReleaseType || 'Release' }}\*
- name: Upload ${{ matrix.os }} ${{ github.event.inputs.ReleaseType || 'Release' }}
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
with:
name: ${{ matrix.os }}-x64
path: cimgui/build/${{ github.event.inputs.ReleaseType || 'Release' }}/*
- name: Upload Definitions Json File
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest' && matrix.architecture == 'x64'
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' && matrix.architecture == 'x64'
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/*
ubuntu-latest-x64/cimgui.so
macos-latest-x64/cimgui.dylib