v2.1.0 #24
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 threading thread%2Dsafe thread%2Dsafety threadsafe maui maui%2Dapp c%2Dsharp dotnet%2Dstandard dotnet%2Dframework dotnet%2Dcore cross%2Dplatform pcl%2Dlibrary xamarin unity csharp net dotnet 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 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 2.0.17 -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}}.2.0.17 | |
# path: ${{ env.PACKAGE_OUTPUT_DIRECTORY}}\${{ env.FILE_NAME}}.2.0.17.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 }} |