diff --git a/.github/workflows/DuplicatiPlugin-nuget-push.yml b/.github/workflows/DuplicatiPlugin-nuget-push.yml new file mode 100644 index 000000000..23cfb09c4 --- /dev/null +++ b/.github/workflows/DuplicatiPlugin-nuget-push.yml @@ -0,0 +1,42 @@ +name: DuplicatiPlugin NuGet Push + +on: + push: + tags: + - 'DuplicatiPlugin-v*' + +jobs: + build: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v1 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.100 + + - name: Build and Pack + run: | + cd ./plugins/DuplicatiPlugin + dotnet build --configuration Release + dotnet pack --configuration Release + dotnet pack --configuration Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg + ls + ls ./bin/Release/ + + - name: Install Nuget + uses: nuget/setup-nuget@v1 + with: + nuget-version: '5.x' + + - name: Add private GitHub registry to NuGet + run: | + nuget sources add -name github -Source https://nuget.pkg.github.com/yiyungent/index.json -Username yiyungent -Password ${{ secrets.GITHUB_TOKEN }} + + - name: Push generated package to GitHub registry and NuGet + run: | + nuget push .\plugins\DuplicatiPlugin\bin\Release\*.nupkg -Source github -SkipDuplicate + nuget push .\plugins\DuplicatiPlugin\bin\Release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.PLUGINCORE_NUGET_KEY }} diff --git a/.github/workflows/DuplicatiPlugin-release.yml b/.github/workflows/DuplicatiPlugin-release.yml index 016209e1a..9576055fc 100644 --- a/.github/workflows/DuplicatiPlugin-release.yml +++ b/.github/workflows/DuplicatiPlugin-release.yml @@ -16,6 +16,18 @@ jobs: with: # 为了让 git 有日志 (git log) 可寻,还得在检出的时候顺带把所有提交历史一并拉下来,指定 fetch-depth 就能做到 fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + + - name: Set outputs + id: vars + run: | + tagPrefix=refs/tags/DuplicatiPlugin- + # 获取字符串长度 + tagPrefixLen=${#tagPrefix} + # 去掉前面的 refs/tags/DuplicatiPlugin- + RELEASE_VERSION=${GITHUB_REF:$tagPrefixLen} + # 提取出 v1.0.0 + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_OUTPUT + shell: bash - name: Setup .NET Core uses: actions/setup-dotnet@v1 @@ -29,13 +41,15 @@ jobs: ls ls ./bin/Release/ ls ./bin/Release/net6.0/ + shell: bash - name: Zip the Build run: | cd ./plugins/DuplicatiPlugin/bin/Release/net6.0 - zip -r DuplicatiPlugin-net6.0.zip * - cd ../../../../../ - mv ./plugins/DuplicatiPlugin/bin/Release/net6.0/*.zip ./ + ls + zip -r DuplicatiPlugin-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0.zip * + ls + shell: bash - name: Create temp-release-note.md run: | @@ -56,6 +70,6 @@ jobs: draft: false prerelease: false files: | - DuplicatiPlugin-net6.0.zip - LICENSE - README.md \ No newline at end of file + ./plugins/DuplicatiPlugin/bin/Release/net6.0/DuplicatiPlugin-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0.zip + ./plugins/DuplicatiPlugin/README.md + ./plugins/DuplicatiPlugin/LICENSE