修改包格式,使用nuspec #5
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: Build Nuget Packages | |
| on: | |
| push: | |
| branches: [ main, 'v[0-9].**' ] | |
| pull_request: | |
| branches: [ main, 'v[0-9].**' ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| filter: tree:0 | |
| - name: Install .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - uses: actions/checkout@master | |
| - uses: nuget/setup-nuget@v2 | |
| with: | |
| nuget-version: '5.x' | |
| - name: Install Mono | |
| run: | | |
| sudo apt update & sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common -y | |
| sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | |
| sudo apt-add-repository 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main' | |
| sudo apt install mono-complete | |
| mono --version | |
| - name: Pack Blazonia nugets | |
| run: nuget pack ./OpenHarmony.NET.Compiler.Pack.nuspec -OutputDirectory ./packages -Version 0.0.0-alpha.${{github.run_number}} | |
| - name: Upload a Build Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages | |
| path: packages | |
| publish-to-nuget: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: packages | |
| path: packages | |
| - name: Push to NuGet | |
| run: | | |
| dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |