Skip to content
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
72 changes: 45 additions & 27 deletions .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,51 @@
name: MeshWeaver release packages
name: Publish NuGet Packages

on:
release:
types: [created]
push:
tags:
- 'v*.*.*'

jobs:
deploy:
publish:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
source-url: https://nuget.pkg.github.com/Systemorph/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore workloads
run: dotnet workload restore
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore -p:CIRun=true
- name: Create the package
run: dotnet pack --output nupkg --configuration Release
- name: Publish the packages to GPR
run: dotnet nuget push nupkg/*.nupkg --source https://nuget.pkg.github.com/Systemorph/index.json --api-key ${GITHUB_TOKEN}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'

- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Restore dependencies
run: dotnet restore

- name: Build solution
run: dotnet build --configuration Release --no-restore /p:Version=${{ env.VERSION }}

- name: Pack NuGet packages
run: dotnet pack --configuration Release --no-build --output ./nupkgs /p:PackageVersion=${{ env.VERSION }}

- name: Publish NuGet packages to GitHub Packages
run: dotnet nuget push ./nupkgs/*.nupkg --source "github"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
nuget.config: |
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="github" value="https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="${{ github.actor }}" />
<add key="ClearTextPassword" value="${{ secrets.GITHUB_TOKEN }}" />
</github>
</packageSourceCredentials>
</configuration>