-
Notifications
You must be signed in to change notification settings - Fork 64
58 lines (46 loc) · 1.89 KB
/
Copy pathnuget.yml
File metadata and controls
58 lines (46 loc) · 1.89 KB
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
name: NuGet
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
build-pack:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate release versions
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PROPS_VERSION=$(grep -oPm1 '(?<=<PackageVersion>)[^<]+' Directory.Build.props)
UNITY_VERSION=$(grep -oPm1 '(?<="version": ")[^"]+' src/Lua.Unity/Assets/Lua.Unity/package.json)
echo "Tag version: ${TAG_VERSION}"
echo "Props version: ${PROPS_VERSION}"
echo "Unity version: ${UNITY_VERSION}"
if [ "${TAG_VERSION}" != "${PROPS_VERSION}" ] || [ "${TAG_VERSION}" != "${UNITY_VERSION}" ]; then
echo "Version mismatch detected."
exit 1
fi
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore Lua.slnx
- name: Test
run: dotnet test tests/Lua.Tests/Lua.Tests.csproj -c Release --no-restore --filter "TestCategory!=ExpectedFailure"
- name: Pack
run: |
dotnet pack src/Lua.Annotations/Lua.Annotations.csproj -c Release --no-restore -o ./artifacts/nuget
dotnet pack src/Lua.SourceGenerator/Lua.SourceGenerator.csproj -c Release --no-restore -o ./artifacts/nuget
dotnet pack src/Lua/Lua.csproj -c Release --no-restore -o ./artifacts/nuget
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: artifacts/nuget/*.nupkg
- name: Publish to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push artifacts/nuget/*.nupkg --api-key "${{ secrets.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate