forked from flibitijibibo/SDL2-CS
-
Notifications
You must be signed in to change notification settings - Fork 6
104 lines (88 loc) · 3.46 KB
/
build-nuget.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
name: Package NuGet
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
nugetPackageVersion:
description: "NuGet package version"
required: true
shouldCreateTag:
description: "Create a git tag + Release?"
required: true
type: boolean
default: true
permissions:
contents: write # "write" needed for the "Tag a release" step.
jobs:
compile-sdl2cs:
name: Build SDL2-CS
uses: ./.github/workflows/build-sdl2cs.yml
compile-natives:
name: Build native dependencies
uses: ./.github/workflows/build-natives.yml
package-nuget:
name: Package NuGet
runs-on: ubuntu-22.04
needs: [compile-sdl2cs, compile-natives]
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Prepare environment variables
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "PACKAGE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "SHOULD_TAG_RELEASE=true" >> $GITHUB_ENV
else
echo "PACKAGE_VERSION=${{ github.event.inputs.nugetPackageVersion }}" >> $GITHUB_ENV
echo "SHOULD_TAG_RELEASE=${{ github.event.inputs.shouldCreateTag }}" >> $GITHUB_ENV
fi
- name: Download artifacts - SDL2-CS.dll
uses: actions/download-artifact@v4
with:
name: SDL2-CS
path: ./bin
- name: Download artifacts - native - Windows
uses: actions/download-artifact@v4
with:
name: Natives-Windows
path: ./native/win
- name: Download artifacts - native - MacOS
uses: actions/download-artifact@v4
with:
name: Natives-MacOS
path: ./native/osx
- name: Download artifacts - native - Linux (x64)
uses: actions/download-artifact@v4
with:
name: Natives-Linux(x64)
path: ./native/linux
- name: Download artifacts - native - Linux (arm64)
uses: actions/download-artifact@v4
with:
name: Natives-Linux(arm64)
path: ./native/linux
- name: Setup NuGet.exe
uses: NuGet/setup-nuget@v1
- name: Package NuGet
run: |
nuget pack OpenRA-SDL2-CS.nuspec -OutputDirectory ./nuget -version ${{ env.PACKAGE_VERSION }}
- name: Upload NuGet package to Artifacts
uses: actions/upload-artifact@v4
with:
name: NuGet Package ${{ env.PACKAGE_VERSION }}
path: ./nuget
- name: Tag a release
if: ${{ env.SHOULD_TAG_RELEASE == 'true' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.PACKAGE_VERSION }}
overwrite: true
file_glob: true
file: ./nuget/*.nupkg
- name: Publish package to NuGet
if: ${{ env.SHOULD_TAG_RELEASE == 'true' }}
run: |
nuget push ./nuget/*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_KEY }}