diff --git a/.github/workflows/release-packages.yml b/.github/workflows/release-packages.yml index 7bba05586..a09da041c 100644 --- a/.github/workflows/release-packages.yml +++ b/.github/workflows/release-packages.yml @@ -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: | + + + + + + + + + + + +