forked from bepu/bepuphysics2
-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (51 loc) · 2.15 KB
/
Copy pathdotnet-core-publish.yml
File metadata and controls
56 lines (51 loc) · 2.15 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
name: .NET Core - Publish NuGet Packages
env:
COMMON_SETTINGS_PATH: CommonSettings.props
BASE_RUN_NUMBER: 23
on: [workflow_dispatch]
jobs:
build:
runs-on: windows-latest
steps:
- name: Print run_number
run: echo ${{ github.run_number }}
- name: Set version number
run: |
$version = "2.5.0-beta.$(${{ github.run_number }} + $env:BASE_RUN_NUMBER)"
echo "VERSION=$version" >> $env:GITHUB_ENV
shell: powershell
- name: Print VERSION
run: echo "VERSION is $env:VERSION"
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
include-prerelease: true
- name: Set Version in CommonSettings.props
run: |
$settingsContent = Get-Content -Path ${{ env.COMMON_SETTINGS_PATH }} -Raw
$updatedContent = $settingsContent -replace '<Version>.*?</Version>', "<Version>${{ env.VERSION }}</Version>"
Set-Content -Path ${{ env.COMMON_SETTINGS_PATH }} -Value $updatedContent
- name: Install dependencies
run: |
dotnet restore DemoContentBuilder
dotnet restore Demos
- name: Build
run: |
dotnet build DemoContentBuilder --configuration Release --no-restore /p:Platform=x64
dotnet build Demos --configuration Release --no-restore
- name: Test
run: dotnet test DemoTests -c Release --verbosity normal
- name: Publish
if: github.event_name != 'pull_request'
run: |
dotnet nuget add source "https://nuget.pkg.github.com/bepu/index.json" --name "github" --username "rossnordby" --password "${{secrets.GITHUB_TOKEN}}"
dotnet pack "BepuPhysics" -c Release
dotnet pack "BepuUtilities" -c Release
dotnet nuget push "**/*.nupkg" -s "github" -k "${{secrets.GITHUB_TOKEN}}" --skip-duplicate
dotnet nuget push "**/*.nupkg" -s "https://api.nuget.org/v3/index.json" -k "${{secrets.NUGET_KEY}}" --skip-duplicate
- name: Create GitHub Release Draft
run: |
gh release create ${{ env.VERSION }} --title "v${{ env.VERSION }}" --notes "Release notes for ${{ env.VERSION }}" --draft
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}