Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: GitHub Actions update #352

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/dotnet-core-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: .NET Core - Publish NuGet Packages

env:
COMMON_SETTINGS_PATH: CommonSettings.props
BASE_RUN_NUMBER: 25

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 }}
32 changes: 20 additions & 12 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
name: .NET Core
name: .NET Core - Build and Test

on: [push, pull_request]
on:
push:
paths-ignore:
- '.github/**'
- 'Documentation/**'
pull_request:
paths-ignore:
- '.github/**'
- 'Documentation/**'

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
include-prerelease: true
Expand All @@ -23,11 +31,11 @@ jobs:
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: 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