This repository was archived by the owner on Oct 1, 2026. It is now read-only.
Repository navigation
80 lines (69 loc) · 2.45 KB
/
Copy pathrelease-please.yml
File metadata and controls
80 lines (69 loc) · 2.45 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: release-please
on:
push:
branches: [ main ]
permissions:
contents: write # required for tags + releases
pull-requests: write # required for release PRs
jobs:
release-please:
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
runs-on: ubuntu-24.04
steps:
- name: Run release-please
id: release
uses: googleapis/release-please-action@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
manifest-file: .release-please-manifest.json
config-file: release-please-config.json
publish:
needs:
- release-please
if: needs.release-please.outputs.release_created
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/cache@v6
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'Directory.Packages.props', 'nuget.config') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: '10.0.x'
- name: Restore
run: |
dotnet tool restore
dotnet restore
- name: Build
run: |
# Build src projects by treating warnings as errors
for proj in $(find src -name '*.csproj'); do
dotnet build "$proj" --no-restore --configuration Release /p:TreatWarningsAsErrors=true
done
# Build test projects normally
for proj in $(find test -name '*.csproj'); do
dotnet build "$proj" --no-restore --configuration Release
done
- name: Test
run: dotnet test --configuration Release --no-build --no-restore
- name: Pack and push to nuget.org
run: |
dotnet pack src/Darp.Geometry --configuration Release --artifacts-path build
for pkg_name in ./build/package/**/*.nupkg; do
dotnet nuget push $pkg_name --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
done
- name: Attach .nupkg to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${{ needs.release-please.outputs.tag_name }}" build/package/**/*.nupkg \
--repo "${{ github.repository }}"