Skip to content

Commit

Permalink
Merge pull request #30 from CompositionalIT/github-releases
Browse files Browse the repository at this point in the history
Split GitHub workflows out into build and release
  • Loading branch information
jwthomson authored Mar 15, 2024
2 parents 5c0e615 + a20de2c commit 3127eec
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
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
25 changes: 14 additions & 11 deletions .github/workflows/deployment.yml → .github/workflows/release.yml
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
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' }}

0 comments on commit 3127eec

Please sign in to comment.