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

📦 GitHub Releases [2nd try] #10

Merged
merged 4 commits into from
Jul 23, 2024
Merged
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
49 changes: 40 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [main]
branches: [ main ]
pull_request:
branches: [main]
branches: [ main ]

jobs:
build:
Expand All @@ -27,10 +27,6 @@ jobs:
useConfigFile: true
additionalArguments: /updateprojectfiles

- name: Set nupkg path (GitVersion-ed)
run: |
echo 'NUPKG_PATH=artifacts/package/release/${{ github.event.repository.name }}.${{ env.GitVersion_SemVer }}.nupkg' >> "$GITHUB_ENV"

- name: Use .NET
uses: actions/setup-dotnet@v4
with:
Expand All @@ -53,19 +49,46 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: dotnet nuget push
- uses: actions/upload-artifact@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
name: nupkg
path: artifacts/package/release/${{ github.event.repository.name }}.${{ env.GitVersion_SemVer }}.nupkg
if-no-files-found: error
retention-days: 1 # Minimal retention b/c only needed for job passing; release manager uploads the same artifact
compression-level: 0 # NuGet pack already compresses so do not re-compress? (Not confirmed)

publish:
if: ${{ github.ref == 'refs/heads/main' }}
name: Publish
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: nupkg

- name: Set up GitReleaseManager
uses: gittools/actions/gitreleasemanager/[email protected]
with:
versionSpec: '0.18.x'

- name: Set nupkg path (GitVersion-ed)
run: |
echo 'NUPKG_PATH=${{ github.event.repository.name }}.${{ env.GitVersion_SemVer }}.nupkg' >> "$GITHUB_ENV"

- name: Publish to NuGet
run: >-
dotnet nuget push ${{ env.NUPKG_PATH }}
--api-key $NUGET_AUTH_TOKEN
--no-symbols
--skip-duplicate
--source https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }}

- uses: gittools/actions/gitreleasemanager/[email protected]
if: ${{ github.ref == 'refs/heads/main' }}
name: Create release (GitReleaseManager)
name: Create release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
Expand All @@ -74,3 +97,11 @@ jobs:
name: v${{ env.GitVersion_SemVer }}
assets: |
${{ env.NUPKG_PATH }}

- uses: gittools/actions/gitreleasemanager/[email protected]
name: Publish release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
repository: ${{ github.event.repository.name }}
milestone: ${{ env.GitVersion_SemVer }}