Skip to content

Commit

Permalink
feat: Updated GitHub Action
Browse files Browse the repository at this point in the history
* Added publishusages.yml to generate and publish HIDDevice.Usages NuGet
* Publish only occurs when source code for relevant NuGet changes
* Build & Test now runs for all other source code changes, and pull requests.
  • Loading branch information
thargy committed Feb 25, 2024
1 parent 1ce1f4a commit 443fe9c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Publish
name: Build and Publish HIDDevices

on:
push:
Expand All @@ -8,6 +8,10 @@ on:
- '**/.md'
- '**/.txt'
- '.github/**'
- 'HIDDevices.Generator/**'
- 'HIDDevices.Usages/**'
- 'HIDDevices.Sample/**'
- 'HIDDevices.Test/**'

jobs:
publish:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/publishusages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Publish HIDDevices.Usages

on:
push:
branches: [ master ]

paths-ignore:
- '**/.md'
- '**/.txt'
- '.github/**'
- 'HIDDevices/**'
- 'HIDDevices.Sample/**'
- 'HIDDevices.Test/**'

jobs:
publish:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Avoid shallow clone so NBGV can do its work.
submodules: 'recursive'
- name: Set version
uses: dotnet/nbgv@v0.4.0
with:
setAllVars: true
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
include-prerelease: true
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration GenerateFromSource --no-restore -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Test
run: dotnet test --configuration GenerateFromSource --no-build --verbosity normal -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Publish
uses: alirezanet/publish-nuget@v3.0.0
with:
PROJECT_FILE_PATH: HIDDevices.Usages/HIDDevices.Usages.csproj
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
INCLUDE_SYMBOLS: true
VERSION_STATIC: ${{env.NBGV_Version}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Validate Pull Request
name: Build and Test

on:
push:
branches: [ master ]

pull_request:
branches: [ master ]

Expand Down
4 changes: 4 additions & 0 deletions HIDDevices.sln
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ Global
{5BE3CAC9-DB63-4A23-869E-9A97B8B5E6ED}.GenerateFromSource|Any CPU.ActiveCfg = GenerateFromSource|Any CPU
{5BE3CAC9-DB63-4A23-869E-9A97B8B5E6ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BE3CAC9-DB63-4A23-869E-9A97B8B5E6ED}.Release|Any CPU.Build.0 = Release|Any CPU
{5BE3CAC9-DB63-4A23-869E-9A97B8B5E6ED}.GenerateFromCache|Any CPU.Build.0 = GenerateFromCache|Any CPU
{5BE3CAC9-DB63-4A23-869E-9A97B8B5E6ED}.GenerateFromSource|Any CPU.Build.0 = GenerateFromSource|Any CPU
{95729392-466B-4985-8803-96AFA24F580E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95729392-466B-4985-8803-96AFA24F580E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95729392-466B-4985-8803-96AFA24F580E}.GenerateFromCache|Any CPU.ActiveCfg = GenerateFromCache|Any CPU
{95729392-466B-4985-8803-96AFA24F580E}.GenerateFromSource|Any CPU.ActiveCfg = GenerateFromSource|Any CPU
{95729392-466B-4985-8803-96AFA24F580E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95729392-466B-4985-8803-96AFA24F580E}.Release|Any CPU.Build.0 = Release|Any CPU
{95729392-466B-4985-8803-96AFA24F580E}.GenerateFromCache|Any CPU.Build.0 = GenerateFromCache|Any CPU
{95729392-466B-4985-8803-96AFA24F580E}.GenerateFromSource|Any CPU.Build.0 = GenerateFromSource|Any CPU
{0E520169-5E25-43C5-BFD3-53FA4D4FF190}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E520169-5E25-43C5-BFD3-53FA4D4FF190}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E520169-5E25-43C5-BFD3-53FA4D4FF190}.GenerateFromCache|Any CPU.ActiveCfg = GenerateFromCache|Any CPU
Expand Down

0 comments on commit 443fe9c

Please sign in to comment.