-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try single workflow with conditional job
- Loading branch information
1 parent
4382eaa
commit 23faf59
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
workflow_call: | ||
push: | ||
branches: | ||
- master | ||
- whatever | ||
# paths: | ||
# - "!*" | ||
# - "Directory.Build.props" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build and Publish NuGet Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
# paths: | ||
# - "Directory.Build.props" | ||
|
||
jobs: | ||
# Based on the example from https://how.wtf/run-workflow-step-or-job-based-on-file-changes-github-actions.html | ||
changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version-changed: ${{ steps.changes.outputs.changed }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dorny/paths-filter@v2 | ||
id: changes | ||
with: | ||
filters: | | ||
changed: | ||
- "Directory.Build.props" | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 7.0.401 | ||
|
||
- name: Restore NuGet packages | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --configuration Release --no-restore | ||
|
||
- name: Test (this will run for several minutes) | ||
run: dotnet test --configuration Release --no-restore --no-build --verbosity normal | ||
|
||
deploy: | ||
needs: | ||
- changes | ||
- build-and-test | ||
runs-on: ubuntu-latest | ||
if: ${{ needs.changes.outputs.version-changed == 'true' }}} | ||
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.event.head_commit.modified || contains('Directory.Build.props') }} | ||
steps: | ||
- name: Publish NuGet package | ||
run: dotnet nuget push Faker/bin/Release/RimuTec.Faker.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |