Skip to content

Commit 3870a7e

Browse files
authored
Merge pull request #724 from irihitech/ci
Using workflow_call to simplify CI
2 parents 1184796 + 139176d commit 3870a7e

File tree

5 files changed

+108
-193
lines changed

5 files changed

+108
-193
lines changed

.github/workflows/pack-nightly.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,19 @@ on:
1010
type: string
1111
Ursa:
1212
description: 'Pack Ursa'
13-
required: true
14-
default: 'true'
13+
default: true
1514
type: boolean
1615
Ursa_Themes_Semi:
1716
description: 'Pack Ursa.Themes.Semi'
18-
required: true
19-
default: 'true'
17+
default: true
2018
type: boolean
2119
PrismExtension:
2220
description: 'Pack Prism Extension'
23-
required: true
24-
default: 'false'
21+
default: false
2522
type: boolean
2623
ReactiveUIExtension:
2724
description: 'Pack ReactiveUI Extension'
28-
required: true
29-
default: 'false'
25+
default: false
3026
type: boolean
3127

3228
jobs:
@@ -40,23 +36,23 @@ jobs:
4036
- name: Get Version
4137
run: |
4238
VERSION_TIMESTAMP=$(date +'%Y%m%d%H%M%S')
43-
VERSION="${{ github.event.inputs.Version_Prefix }}-nightly-${VERSION_TIMESTAMP}"
39+
VERSION="${{ inputs.Version_Prefix }}-nightly-${VERSION_TIMESTAMP}"
4440
echo "VERSION=$VERSION" >> $GITHUB_ENV
4541
4642
- name: Pack Ursa
47-
if: ${{ github.event.inputs.Ursa == 'true' }}
43+
if: ${{ inputs.Ursa }}
4844
run: dotnet pack src/Ursa -o nugets /p:Version=${{ env.VERSION }}
4945

5046
- name: Pack Ursa.Themes.Semi
51-
if: ${{ github.event.inputs.Ursa_Themes_Semi == 'true' }}
47+
if: ${{ inputs.Ursa_Themes_Semi }}
5248
run: dotnet pack src/Ursa.Themes.Semi -o nugets /p:Version=${{ env.VERSION }}
5349

5450
- name: Pack Prism Extension
55-
if: ${{ github.event.inputs.PrismExtension == 'true' }}
51+
if: ${{ inputs.PrismExtension }}
5652
run: dotnet pack src/Ursa.PrismExtension -o nugets /p:Version=${{ env.VERSION }}
5753

5854
- name: Pack ReactiveUI Extension
59-
if: ${{ github.event.inputs.ReactiveUIExtension == 'true' }}
55+
if: ${{ inputs.ReactiveUIExtension }}
6056
run: dotnet pack src/Ursa.ReactiveUIExtension -o nugets /p:Version=${{ env.VERSION }}
6157

6258
- name: Add NuGet Source

.github/workflows/pack.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,42 @@ name: Pack to NuGet
33
on:
44
workflow_dispatch:
55
inputs:
6+
Upload_to_NuGet:
7+
description: 'Upload to NuGet'
8+
default: true
9+
type: boolean
610
Ursa:
711
description: 'Pack Ursa'
8-
required: true
9-
default: 'true'
12+
default: true
1013
type: boolean
1114
Ursa_Themes_Semi:
1215
description: 'Pack Ursa.Themes.Semi'
13-
required: true
14-
default: 'true'
16+
default: true
1517
type: boolean
1618
PrismExtension:
1719
description: 'Pack Prism Extension'
18-
required: true
19-
default: 'false'
20+
default: false
2021
type: boolean
2122
ReactiveUIExtension:
2223
description: 'Pack ReactiveUI Extension'
23-
required: true
24-
default: 'false'
24+
default: false
25+
type: boolean
26+
workflow_call:
27+
inputs:
28+
Upload_to_NuGet:
29+
type: boolean
30+
default: false
31+
Ursa:
32+
default: true
33+
type: boolean
34+
Ursa_Themes_Semi:
35+
default: true
36+
type: boolean
37+
PrismExtension:
38+
default: false
39+
type: boolean
40+
ReactiveUIExtension:
41+
default: false
2542
type: boolean
2643

2744
jobs:
@@ -32,22 +49,23 @@ jobs:
3249
uses: actions/[email protected]
3350

3451
- name: Pack Ursa
35-
if: ${{ github.event.inputs.Ursa == 'true' }}
52+
if: ${{ inputs.Ursa }}
3653
run: dotnet pack src/Ursa -o nugets
3754

3855
- name: Pack Ursa.Themes.Semi
39-
if: ${{ github.event.inputs.Ursa_Themes_Semi == 'true' }}
56+
if: ${{ inputs.Ursa_Themes_Semi }}
4057
run: dotnet pack src/Ursa.Themes.Semi -o nugets
4158

4259
- name: Pack Prism Extension
43-
if: ${{ github.event.inputs.PrismExtension == 'true' }}
60+
if: ${{ inputs.PrismExtension }}
4461
run: dotnet pack src/Ursa.PrismExtension -o nugets
4562

4663
- name: Pack ReactiveUI Extension
47-
if: ${{ github.event.inputs.ReactiveUIExtension == 'true' }}
64+
if: ${{ inputs.ReactiveUIExtension }}
4865
run: dotnet pack src/Ursa.ReactiveUIExtension -o nugets
4966

50-
- name: Publish NuGet package
67+
- name: Upload to NuGet
68+
if: ${{ inputs.Upload_to_NuGet }}
5169
run: dotnet nuget push "nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
5270

5371
- name: Upload a Build Artifact

.github/workflows/publish.yml

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,65 @@ on:
55
inputs:
66
win-x64:
77
description: 'Windows x64'
8-
required: true
98
default: false
109
type: boolean
1110
win-x64-aot:
1211
description: 'Windows x64 AOT'
13-
required: true
1412
default: false
1513
type: boolean
1614
linux-x64:
1715
description: 'Linux x64'
18-
required: true
1916
default: false
2017
type: boolean
2118
linux-x64-aot:
2219
description: 'Linux x64 AOT'
23-
required: true
2420
default: false
2521
type: boolean
2622
osx-arm64:
2723
description: 'macOS arm64'
28-
required: true
2924
default: false
3025
type: boolean
3126
osx-arm64-aot:
3227
description: 'macOS arm64 AOT'
33-
required: true
3428
default: false
3529
type: boolean
3630
android-arm64:
3731
description: 'Android arm64'
38-
required: true
3932
default: false
4033
type: boolean
34+
workflow_call:
35+
inputs:
36+
win-x64:
37+
type: boolean
38+
default: true
39+
win-x64-aot:
40+
type: boolean
41+
default: true
42+
linux-x64:
43+
type: boolean
44+
default: true
45+
linux-x64-aot:
46+
type: boolean
47+
default: true
48+
osx-arm64:
49+
type: boolean
50+
default: true
51+
osx-arm64-aot:
52+
type: boolean
53+
default: true
54+
android-arm64:
55+
type: boolean
56+
default: true
4157

4258
jobs:
4359
win-x64:
44-
if: ${{ github.event.inputs.win-x64 == 'true' }}
60+
if: ${{ inputs.win-x64 }}
4561
runs-on: windows-latest
4662
steps:
4763
- name: Checkout
4864
uses: actions/[email protected]
4965
- name: Publish win-x64
50-
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o publish --sc -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
66+
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
5167
- name: Upload a Build Artifact
5268
uses: actions/[email protected]
5369
with:
@@ -57,15 +73,13 @@ jobs:
5773
!publish/*.pdb
5874
5975
win-x64-aot:
60-
if: ${{ github.event.inputs.win-x64-aot == 'true' }}
76+
if: ${{ inputs.win-x64-aot }}
6177
runs-on: windows-latest
6278
steps:
6379
- name: Checkout
6480
uses: actions/[email protected]
6581
- name: Enable Native AOT in .csproj
66-
run: |
67-
sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
68-
sed -i 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
82+
run: sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
6983
- name: Publish win-x64 AOT
7084
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o publish
7185
- name: Upload a Build Artifact
@@ -77,13 +91,13 @@ jobs:
7791
!publish/*.pdb
7892
7993
linux-x64:
80-
if: ${{ github.event.inputs.linux-x64 == 'true' }}
94+
if: ${{ inputs.linux-x64 }}
8195
runs-on: ubuntu-latest
8296
steps:
8397
- name: Checkout
8498
uses: actions/[email protected]
8599
- name: Publish linux-x64
86-
run: dotnet publish demo/Ursa.Demo.Desktop -r linux-x64 -c Release -o publish --sc -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
100+
run: dotnet publish demo/Ursa.Demo.Desktop -r linux-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
87101
- name: Upload a Build Artifact
88102
uses: actions/[email protected]
89103
with:
@@ -93,15 +107,13 @@ jobs:
93107
!publish/*.pdb
94108
95109
linux-x64-aot:
96-
if: ${{ github.event.inputs.linux-x64-aot == 'true' }}
110+
if: ${{ inputs.linux-x64-aot }}
97111
runs-on: ubuntu-latest
98112
steps:
99113
- name: Checkout
100114
uses: actions/[email protected]
101115
- name: Enable Native AOT in .csproj
102-
run: |
103-
sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
104-
sed -i 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
116+
run: sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
105117
- name: Publish linux-x64 AOT
106118
run: dotnet publish demo/Ursa.Demo.Desktop -r linux-x64 -c Release -o publish
107119
- name: Upload a Build Artifact
@@ -113,13 +125,13 @@ jobs:
113125
!publish/*.pdb
114126
115127
osx-arm64:
116-
if: ${{ github.event.inputs.osx-arm64 == 'true' }}
128+
if: ${{ inputs.osx-arm64 }}
117129
runs-on: macos-latest
118130
steps:
119131
- name: Checkout
120132
uses: actions/[email protected]
121133
- name: Publish osx-arm64
122-
run: dotnet publish demo/Ursa.Demo.Desktop -r osx-arm64 -c Release -o publish --sc -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
134+
run: dotnet publish demo/Ursa.Demo.Desktop -r osx-arm64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
123135
- name: Upload a Build Artifact
124136
uses: actions/[email protected]
125137
with:
@@ -129,15 +141,13 @@ jobs:
129141
!publish/*.pdb
130142
131143
osx-arm64-aot:
132-
if: ${{ github.event.inputs.osx-arm64-aot == 'true' }}
144+
if: ${{ inputs.osx-arm64-aot }}
133145
runs-on: macos-latest
134146
steps:
135147
- name: Checkout
136148
uses: actions/[email protected]
137149
- name: Enable Native AOT in .csproj
138-
run: |
139-
sed -i '' 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
140-
sed -i '' 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
150+
run: sed -i '' 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
141151
- name: Publish osx-arm64 AOT
142152
run: dotnet publish demo/Ursa.Demo.Desktop -r osx-arm64 -c Release -o publish
143153
- name: Upload a Build Artifact
@@ -149,7 +159,7 @@ jobs:
149159
!publish/*.pdb
150160
151161
android-arm64:
152-
if: ${{ github.event.inputs.android-arm64 == 'true' }}
162+
if: ${{ inputs.android-arm64 }}
153163
runs-on: windows-latest
154164
steps:
155165
- name: Checkout
@@ -159,7 +169,7 @@ jobs:
159169
- name: Restore Dependencies
160170
run: dotnet restore
161171
- name: Publish Android
162-
run: dotnet publish demo/Ursa.Demo.Android -c Release -f net8.0-android --no-restore -o publish -p:RuntimeIdentifier=android-arm64
172+
run: dotnet publish demo/Ursa.Demo.Android -c Release -f net8.0-android --no-restore -o publish /p:RuntimeIdentifier=android-arm64
163173
- name: Upload a Build Artifact
164174
uses: actions/[email protected]
165175
with:

0 commit comments

Comments
 (0)