-
Notifications
You must be signed in to change notification settings - Fork 3
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
Split GitHub workflows out into build and release #30
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/[email protected] | ||
|
||
- name: Restore tools | ||
run: dotnet tool restore | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore | ||
working-directory: ./src | ||
|
||
- name: Build | ||
run: dotnet build --configuration Release --no-restore | ||
working-directory: ./src |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
name: Nuget-Publish | ||
name: Release Package | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Check out | ||
uses: actions/[email protected] | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: 6.0.300 | ||
|
||
- name: Restore tools | ||
run: dotnet tool restore | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore | ||
working-directory: ./src | ||
|
||
- name: Build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we do run on every push/merge to master, can we reuse the artifact somehow rather than building from scratch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. Let's make this an investigation task for another day! |
||
run: dotnet build --configuration Release --no-restore | ||
working-directory: ./src | ||
|
||
- name: Pack | ||
run: dotnet pack --configuration Release --no-build --output . | ||
run: dotnet pack --no-build -p:PackageVersion=${{ github.ref_name }} -p:PackageReleaseNotes=${{ github.event.release.html_url }} --output . | ||
working-directory: ./src | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
|
||
- name: Publish | ||
run: dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json | ||
working-directory: ./src | ||
if: ${{ github.ref == 'refs/heads/main' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that push doesn't include merges? Do we want to build on merge too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see an alternative which would seem to include merges. I would have thought that a merge is just a merge commit, which is then pushed, and then the push would trigger this workflow. Or perhaps my understanding is lacking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A merge wouldn't have to be pushed if it was done directly within the GitHub repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does trigger on merge to main.