Skip to content

Nuget Publish

Nuget Publish #4

Workflow file for this run

name: Nuget Publish
on:
workflow_dispatch:
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
Publish:
runs-on: ubuntu-latest
outputs:
releaseVersion: ${{ steps.semver.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Git Semantic Version
id: semver
uses: PaulHatch/[email protected]
- name: Create Tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.semver.outputs.version }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore ./Optimizely.Graph.Source.Sdk/Optimizely.Graph.Source.Sdk.sln
- name: Build
run: dotnet build --no-restore ./Optimizely.Graph.Source.Sdk/Optimizely.Graph.Source.Sdk.sln
- name: Package
run: dotnet pack ./Optimizely.Graph.Source.Sdk/Optimizely.Graph.Source.Sdk/Optimizely.Graph.Source.Sdk.csproj --configuration Release -p:PackageVersion=${{ steps.semver.outputs.version }}
- name: Publish to Episerver
run: dotnet nuget push ./Optimizely.Graph.Source.Sdk/Optimizely.Graph.Source.Sdk/bin/Release/Optimizely.Graph.Source.Sdk.${{ steps.semver.outputs.version }}.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/episerver/index.json
upload_T3:
runs-on: [self-hosted]
needs: [Publish]
steps:
- name: Publish Nuget
run: |
$sourceDirectory = '${{github.workspace}}\Optimizely.Graph.Source.Sdk\Optimizely.Graph.Source.Sdk\bin\Release\'
$destinationDirectory = '\\nuget.ep.se\Releases\thisweek'
$file = Get-ChildItem -Path "$sourceDirectory" -Recurse | Where-Object {$_.Name -match 'Optimizely.Graph.Source.Sdk.${{ needs.Publish.outputs.releaseVersion }}.nupkg'}
xcopy $file.FullName $destinationDirectory /Y