Merge pull request #6 from sleushunou/main #34
This file contains 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: .NET Core | |
on: | |
pull_request: | |
push: | |
release: | |
types: [published] | |
jobs: | |
build: | |
name: Build | |
env: | |
NUPKG_MAJOR: 3.999 | |
CODESIGN_PFX: ${{ secrets.CODESIGN_PFX }} | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# - name: Setup .NET | |
# uses: actions/setup-dotnet@v3 | |
# with: | |
# dotnet-version: | | |
# 6.0.x | |
# 7.0.x | |
# - name: Setup .NET MAUI | |
# shell: pwsh | |
# run: | | |
# & dotnet workload install maui ios android maccatalyst | |
- name: Build | |
run: dotnet build --configuration Release | |
# - name: Test | |
# run: dotnet test --configuration Release | |
- name: Package NuGets | |
shell: pwsh | |
run: | | |
$VERSION="$env:NUPKG_MAJOR-ci$env:GITHUB_RUN_ID" | |
if ($env:GITHUB_EVENT_NAME -eq "release") { | |
$VERSION = $env:GITHUB_REF.Substring($env:GITHUB_REF.LastIndexOf('/') + 1) | |
} | |
echo "::set-output name=pkgverci::$VERSION" | |
echo "PACKAGE VERSION: $VERSION" | |
New-Item -ItemType Directory -Force -Path .\artifacts | |
dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./source/FFImageLoading/FFImageLoading.csproj | |
dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./source/FFImageLoading.Maui/FFImageLoading.Maui.csproj | |
dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./source/FFImageLoading.Svg/FFImageLoading.Svg.csproj | |
dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./source/FFImageLoading.Svg.Maui/FFImageLoading.Svg.Maui.csproj | |
dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./source/FFImageLoading.Transformations/FFImageLoading.Transformations.csproj | |
$pfxPath = Join-Path -Path $pwd -ChildPath "codesigncert.pfx" | |
[IO.File]::WriteAllBytes("$pfxPath", [System.Convert]::FromBase64String($env:CODESIGN_PFX)) | |
dotnet nuget sign .\artifacts\*.nupkg --certificate-path $pfxPath --timestamper http://timestamp.entrust.net/TSS/RFC3161sha2TS | |
- name: Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: NuGet | |
path: ./artifacts | |
publish: | |
name: Publish | |
needs: build | |
runs-on: windows-latest | |
if: github.event_name == 'release' | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: NuGet | |
- name: Push NuGet | |
run: | | |
dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} |