Skip to content

Commit

Permalink
ci(.github/workflows): duplicatiPlugin-*.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyungent committed Jan 19, 2024
1 parent 5cb5d83 commit 3df4f71
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 6 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/DuplicatiPlugin-nuget-push.yml
Original file line number Diff line number Diff line change
@@ -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 }}
26 changes: 20 additions & 6 deletions .github/workflows/DuplicatiPlugin-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -56,6 +70,6 @@ jobs:
draft: false
prerelease: false
files: |
DuplicatiPlugin-net6.0.zip
LICENSE
README.md
./plugins/DuplicatiPlugin/bin/Release/net6.0/DuplicatiPlugin-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0.zip
./plugins/DuplicatiPlugin/README.md
./plugins/DuplicatiPlugin/LICENSE

0 comments on commit 3df4f71

Please sign in to comment.