Skip to content

Commit f62afad

Browse files
authored
Merge pull request #215 from AsakusaRinne/auto_release_ci
ci: try to fix error of pushing package.
2 parents 3fd1063 + a5e66b3 commit f62afad

File tree

5 files changed

+103
-46
lines changed

5 files changed

+103
-46
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: release-minor-trigger
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
types: [ closed ]
8+
9+
jobs:
10+
trigger_minor_release:
11+
if: contains(github.event.pull_request.labels.*.name, 'minor-release') && !contains(github.event.pull_request.labels.*.name, 'patch-release')
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Setup .NET 6.0.x SDK
17+
uses: actions/setup-dotnet@v3
18+
with:
19+
dotnet-version: 6.0.x
20+
Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
1-
name: release-prepare
1+
name: auto-release
22

33
on:
4-
pull_request:
5-
branches:
6-
- master
7-
types: [ closed ]
4+
workflow_run:
5+
workflows: ["release-minor-trigger"]
6+
types:
7+
- completed
88

99
env:
10-
IS_MINOR: ${{contains(github.event.pull_request.labels.*.name, 'minor-release')}}
11-
IS_PATCH: ${{contains(github.event.pull_request.labels.*.name, 'patch-release')}}
10+
NUGET_API_TOKEN: ${{ secrets.LLAMA_SHARP_NUGET_KEY }}
1211

1312
jobs:
14-
prepare_package:
15-
if: contains(github.event.pull_request.labels.*.name, 'minor-release') || contains(github.event.pull_request.labels.*.name, 'patch-release')
13+
minor_release_to_nuget:
1614
runs-on: ubuntu-latest
17-
18-
steps:
19-
- uses: actions/checkout@v3
20-
- name: Setup .NET 6.0.x SDK
21-
uses: actions/setup-dotnet@v3
22-
with:
23-
dotnet-version: 6.0.x
2415

16+
steps:
2517
- name: Setup NuGet
2618
uses: nuget/setup-nuget@v1
2719
with:
@@ -46,10 +38,13 @@ jobs:
4638
git fetch origin;
4739
4840
chmod +x ./.github/prepare_release.sh
49-
./.github/prepare_release.sh $IS_MINOR $IS_PATCH
41+
./.github/prepare_release.sh true false
5042
5143
- name: Upload packages artifacts
5244
uses: actions/upload-artifact@v2
5345
with:
5446
name: "drop-ci-packages"
55-
path: './temp'
47+
path: './temp'
48+
49+
- name: Push LLamaSharp packages to nuget.org
50+
run: dotnet nuget push ./temp/LLamaSharp*.nupkg --source https://www.nuget.org -k ${{ secrets.LLAMA_SHARP_NUGET_KEY }} --skip-duplicate
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: release-patch-trigger
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
types: [ closed ]
8+
9+
jobs:
10+
trigger_patch_release:
11+
if: contains(github.event.pull_request.labels.*.name, 'patch-release') && !contains(github.event.pull_request.labels.*.name, 'minor-release')
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Setup .NET 6.0.x SDK
17+
uses: actions/setup-dotnet@v3
18+
with:
19+
dotnet-version: 6.0.x
20+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: auto-release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["release-patch-trigger"]
6+
types:
7+
- completed
8+
9+
env:
10+
NUGET_API_TOKEN: ${{ secrets.LLAMA_SHARP_NUGET_KEY }}
11+
12+
jobs:
13+
patch_release_to_nuget:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Setup NuGet
18+
uses: nuget/setup-nuget@v1
19+
with:
20+
nuget-api-key: $NUGET_API_TOKEN
21+
nuget-version: 'latest'
22+
23+
- name: Check .NET info
24+
run: dotnet --info
25+
26+
- name: Install dependencies
27+
run: dotnet restore
28+
29+
- name: Build solution
30+
run: |
31+
dotnet build ./LLama/LLamaSharp.csproj -c Release --no-restore
32+
dotnet build ./LLama.SemanticKernel/LLamaSharp.SemanticKernel.csproj -c Release --no-restore
33+
34+
- name: Pack packages
35+
run: |
36+
git fetch --unshallow;
37+
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*";
38+
git fetch origin;
39+
40+
chmod +x ./.github/prepare_release.sh
41+
./.github/prepare_release.sh false true
42+
43+
- name: Upload packages artifacts
44+
uses: actions/upload-artifact@v2
45+
with:
46+
name: "drop-ci-packages"
47+
path: './temp'
48+
49+
- name: Push LLamaSharp packages to nuget.org
50+
run: dotnet nuget push ./temp/LLamaSharp*.nupkg --source https://www.nuget.org -k ${{ secrets.LLAMA_SHARP_NUGET_KEY }} --skip-duplicate

.github/workflows/release.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)