明确使用 PowerShell 风格 #22
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: Publish MediaConverters NuGet | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| jobs: | |
| PackOnWindows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dotnet tool | |
| run: dotnet tool install -g dotnetCampus.TagToVersion | |
| - name: Set tag to version | |
| run: dotnet TagToVersion -t ${{ github.ref }} | |
| - name: Build with dotnet | |
| run: dotnet build --configuration Release src\MediaConverters\MediaConverters.sln | |
| - name: Pack MediaConverters.Tool.ContextNuGet | |
| run: dotnet pack --no-build true --configuration Release src\MediaConverters\MediaConverters.Tool.ContextNuGet\MediaConverters.Tool.ContextNuGet.csproj | |
| - name: Pack DotNetCampus.MediaConverter.SkiaWmfRenderer | |
| run: dotnet pack --no-build true --configuration Release src\MediaConverters\SkiaWmfRenderer\src\SkiaWmfRenderer\SkiaWmfRenderer.csproj | |
| - name: Publish and Pack win-x86 | |
| run: | | |
| dotnet publish -c Release -r win-x86 src\MediaConverters\MediaConverters.Tool\MediaConverters.Tool.csproj | |
| dotnet pack --configuration Release /p:RuntimeIdentifier=win-x86 src\MediaConverters\MediaConverters.Tool.RuntimeNuGet\MediaConverters.Tool.RuntimeNuGet.csproj | |
| - name: Publish and Pack win-x64 | |
| run: | | |
| dotnet publish -c Release -r win-x64 src\MediaConverters\MediaConverters.Tool\MediaConverters.Tool.csproj | |
| dotnet pack --configuration Release /p:RuntimeIdentifier=win-x64 src\MediaConverters\MediaConverters.Tool.RuntimeNuGet\MediaConverters.Tool.RuntimeNuGet.csproj | |
| - name: Push generated package to NuGet | |
| run: | | |
| dotnet nuget push .\bin\Release\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NugetKey }} | |
| dotnet nuget push .\bin\Release\*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }} --api-key ${{ secrets.GITHUB_TOKEN }} --timeout 3000 | |
| PackOnWindowsArm64: | |
| runs-on: windows-11-arm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dotnet tool | |
| run: dotnet tool install -g dotnetCampus.TagToVersion | |
| - name: Set tag to version | |
| run: dotnet TagToVersion -t ${{ github.ref }} | |
| - name: Build with dotnet | |
| run: dotnet build --configuration Release src\MediaConverters\MediaConverters.sln | |
| - name: Publish and Pack win-arm64 | |
| run: | | |
| dotnet publish -c Release -r win-arm64 src\MediaConverters\MediaConverters.Tool\MediaConverters.Tool.csproj | |
| dotnet pack --configuration Release /p:RuntimeIdentifier=win-arm64 src\MediaConverters\MediaConverters.Tool.RuntimeNuGet\MediaConverters.Tool.RuntimeNuGet.csproj | |
| - name: Push generated package to NuGet | |
| run: | | |
| dotnet nuget push .\bin\Release\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NugetKey }} | |
| dotnet nuget push .\bin\Release\*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }} --api-key ${{ secrets.GITHUB_TOKEN }} --timeout 3000 | |
| PackOnLinuxX64: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: debian:buster-slim | |
| steps: | |
| # 由于 Debian 10 (buster) 停止维护了,需要换成 archive.debian.org 源头 | |
| - name: UpdateSource | |
| run: | | |
| rm /etc/apt/sources.list | |
| echo 'deb http://archive.debian.org/debian buster main contrib non-free' >> /etc/apt/sources.list | |
| echo 'deb http://archive.debian.org/debian buster-updates main contrib non-free' >> /etc/apt/sources.list | |
| echo 'deb http://archive.debian.org/debian-security buster/updates main contrib non-free' >> /etc/apt/sources.list | |
| - name: InstallTool | |
| run: | | |
| dpkg --add-architecture arm64 | |
| apt-get clean | |
| apt-get update | |
| apt-get install libicu-dev -y | |
| apt-get install libssl-dev -y | |
| apt-get install wget -y | |
| apt-get install curl -y | |
| apt-get install clang llvm -y | |
| apt-get install gcc-aarch64-linux-gnu -y | |
| apt-get install binutils-aarch64-linux-gnu -y | |
| apt-get install zlib1g-dev -y | |
| apt-get install zlib1g-dev:arm64 -y | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v1 | |
| with: | |
| dotnet-version: | | |
| 3.1.x | |
| 5.0.x | |
| 6.0.x | |
| 9.0.x | |
| - name: Add .NET global tools to PATH | |
| run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH | |
| - name: Install dotnet tool | |
| run: dotnet tool install -g dotnetCampus.TagToVersion | |
| - name: Set tag to version | |
| run: dotnet-TagToVersion -t ${{ github.ref }} | |
| - name: Build with dotnet | |
| run: dotnet build --configuration Release src/MediaConverters/MediaConverters.sln | |
| - name: Publish and Pack linux-x64 | |
| run: | | |
| dotnet publish -c Release -r linux-x64 src/MediaConverters/MediaConverters.Tool/MediaConverters.Tool.csproj | |
| dotnet pack --configuration Release /p:RuntimeIdentifier=linux-x64 src/MediaConverters/MediaConverters.Tool.RuntimeNuGet/MediaConverters.Tool.RuntimeNuGet.csproj | |
| - name: Push generated package to NuGet | |
| run: | | |
| dotnet nuget push ./bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NugetKey }} | |
| dotnet nuget push ./bin/Release/*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }} --api-key ${{ secrets.GITHUB_TOKEN }} --timeout 3000 | |
| PackOnLinuxArm64: | |
| runs-on: ubuntu-24.04-arm | |
| container: | |
| image: debian:buster-slim | |
| steps: | |
| # 由于 Debian 10 (buster) 停止维护了,需要换成 archive.debian.org 源头 | |
| - name: UpdateSource | |
| run: | | |
| rm /etc/apt/sources.list | |
| echo 'deb http://archive.debian.org/debian buster main contrib non-free' >> /etc/apt/sources.list | |
| echo 'deb http://archive.debian.org/debian buster-updates main contrib non-free' >> /etc/apt/sources.list | |
| echo 'deb http://archive.debian.org/debian-security buster/updates main contrib non-free' >> /etc/apt/sources.list | |
| - name: InstallTool | |
| run: | | |
| dpkg --add-architecture arm64 | |
| apt-get clean | |
| apt-get update | |
| apt-get install libicu-dev -y | |
| apt-get install libssl-dev -y | |
| apt-get install wget -y | |
| apt-get install curl -y | |
| apt-get install clang llvm -y | |
| apt-get install gcc-aarch64-linux-gnu -y | |
| apt-get install binutils-aarch64-linux-gnu -y | |
| apt-get install zlib1g-dev -y | |
| apt-get install zlib1g-dev:arm64 -y | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v1 | |
| with: | |
| dotnet-version: | | |
| 3.1.x | |
| 5.0.x | |
| 6.0.x | |
| 9.0.x | |
| - name: Add .NET global tools to PATH | |
| run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH | |
| - name: Install dotnet tool | |
| run: dotnet tool install -g dotnetCampus.TagToVersion | |
| - name: Set tag to version | |
| run: dotnet-TagToVersion -t ${{ github.ref }} | |
| - name: Build with dotnet | |
| run: dotnet build --configuration Release src/MediaConverters/MediaConverters.sln | |
| - name: Publish and Pack linux-arm64 | |
| run: | | |
| dotnet publish -c Release -r linux-arm64 src/MediaConverters/MediaConverters.Tool/MediaConverters.Tool.csproj | |
| dotnet pack --configuration Release /p:RuntimeIdentifier=linux-arm64 src/MediaConverters/MediaConverters.Tool.RuntimeNuGet/MediaConverters.Tool.RuntimeNuGet.csproj | |
| - name: Push generated package to NuGet | |
| run: | | |
| dotnet nuget push ./bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NugetKey }} | |
| dotnet nuget push ./bin/Release/*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }} --api-key ${{ secrets.GITHUB_TOKEN }} --timeout 3000 |