-
Notifications
You must be signed in to change notification settings - Fork 65
137 lines (118 loc) · 4.74 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
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