Skip to content

CD

CD #17

Workflow file for this run

name: CD
on:
workflow_dispatch:
# release:
# types: [published]
env:
TITLE: "Thread-Safe Objects"
DESCRIPTION: "A combination of generic Thread-Safe objects for .Net development."
TAGS: "thunderdesign visual%2Dstudio c%2Dsharp dotnet%2Dstandard dotnet%2Dframework dotnet%2Dcore cross%2Dplatform pcl%2Dlibrary mono xamarin%2Dforms xamarin%2Dandroid xamarin%2Dios xamarin%2Dmac xamarin%2Duwp unity csharp net dotnet threading bindable binding"
#FILE_NAME: ex: "ThunderDesign.Net-PCL.Threading"
FILE_NAME: "${{ github.event.repository.name }}"
#REPOSITORY_NAME: ex: "ThunderDesign.Net-PCL.Threading"
REPOSITORY_NAME: ${{ github.event.repository.name }}
#REPOSITORY_OWNER: ex: "ThunderDesign"
REPOSITORY_OWNER: ${{ github.repository_owner }}
#GITHUB_URL: ex: "https://github.com/ThunderDesign"
GITHUB_URL: ${{ github.server_url }}/${{ github.repository_owner }}
#REPOSITORY_URL: ex: "https://github.com/ThunderDesign/ThunderDesign.Net-PCL.Threading"
REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository_owner }}/${{ github.event.repository.name }}
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}\output
jobs:
pack:
runs-on: [windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET 2.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.0.x
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Setup .NET 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5
- name: Restore NuGet packages.sln
run: nuget restore ./src/${{ env.FILE_NAME}}.sln
- name: Build Solution
run: msbuild ./src/${{ env.FILE_NAME}}.sln /p:Configuration=Release
- name: Prepare .nuspec
run: |
$nuspecPath = "src/${{ env.FILE_NAME }}.nuspec.in"
$nuspec = Get-Content $nuspecPath
$nuspec = $nuspec -replace '\$\{\{ env.FILE_NAME \}\}', '${{ env.FILE_NAME }}'
$nuspec = $nuspec -replace '\$\{\{ env.TITLE \}\}', '${{ env.TITLE }}'
$nuspec = $nuspec -replace '\$\{\{ env.DESCRIPTION \}\}', '${{ env.DESCRIPTION }}'
$nuspec = $nuspec -replace '\$\{\{ env.TAGS \}\}', '${{ env.TAGS }}'
$nuspec = $nuspec -replace '\$\{\{ env.GITHUB_URL \}\}', '${{ env.GITHUB_URL }}'
$nuspec = $nuspec -replace '\$\{\{ env.REPOSITORY_URL \}\}', '${{ env.REPOSITORY_URL }}'
Set-Content ThunderDesign.Net-PCL.nuspec $nuspec
shell: pwsh
- name: Create NuGet Package
run: nuget pack ThunderDesign.Net-PCL.nuspec -Version 1.1.1 -OutputDirectory ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
# run: nuget pack ThunderDesign.Net-PCL.nuspec -Version ${{ github.event.release.tag_name }} -OutputDirectory ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
- name: Archive NuGet Package
uses: actions/upload-artifact@v4
with:
name: Package_${{ env.FILE_NAME}}.1.1.1
path: ${{ env.PACKAGE_OUTPUT_DIRECTORY}}\${{ env.FILE_NAME}}.1.1.1.nupkg
# name: Package_${{ env.FILE_NAME}}.${{ github.event.release.tag_name }}
# path: ${{ env.PACKAGE_OUTPUT_DIRECTORY}}\${{ env.FILE_NAME}}.${{ github.event.release.tag_name }}.nupkg
# - name: Publish NuGet Package
# run: nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY}}\${{ env.FILE_NAME}}.${{ github.event.release.tag_name }}.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}