Skip to content

Commit

Permalink
Merge pull request #215 from AsakusaRinne/auto_release_ci
Browse files Browse the repository at this point in the history
ci: try to fix error of pushing package.
  • Loading branch information
AsakusaRinne authored Oct 24, 2023
2 parents 3fd1063 + a5e66b3 commit f62afad
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 46 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/release-minor-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: release-minor-trigger

on:
pull_request:
branches:
- master
types: [ closed ]

jobs:
trigger_minor_release:
if: contains(github.event.pull_request.labels.*.name, 'minor-release') && !contains(github.event.pull_request.labels.*.name, 'patch-release')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET 6.0.x SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
name: release-prepare
name: auto-release

on:
pull_request:
branches:
- master
types: [ closed ]
workflow_run:
workflows: ["release-minor-trigger"]
types:
- completed

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

jobs:
prepare_package:
if: contains(github.event.pull_request.labels.*.name, 'minor-release') || contains(github.event.pull_request.labels.*.name, 'patch-release')
minor_release_to_nuget:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET 6.0.x SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

steps:
- name: Setup NuGet
uses: nuget/setup-nuget@v1
with:
Expand All @@ -46,10 +38,13 @@ jobs:
git fetch origin;
chmod +x ./.github/prepare_release.sh
./.github/prepare_release.sh $IS_MINOR $IS_PATCH
./.github/prepare_release.sh true false
- name: Upload packages artifacts
uses: actions/upload-artifact@v2
with:
name: "drop-ci-packages"
path: './temp'
path: './temp'

- name: Push LLamaSharp packages to nuget.org
run: dotnet nuget push ./temp/LLamaSharp*.nupkg --source https://www.nuget.org -k ${{ secrets.LLAMA_SHARP_NUGET_KEY }} --skip-duplicate
20 changes: 20 additions & 0 deletions .github/workflows/release-patch-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: release-patch-trigger

on:
pull_request:
branches:
- master
types: [ closed ]

jobs:
trigger_patch_release:
if: contains(github.event.pull_request.labels.*.name, 'patch-release') && !contains(github.event.pull_request.labels.*.name, 'minor-release')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET 6.0.x SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

50 changes: 50 additions & 0 deletions .github/workflows/release-patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: auto-release

on:
workflow_run:
workflows: ["release-patch-trigger"]
types:
- completed

env:
NUGET_API_TOKEN: ${{ secrets.LLAMA_SHARP_NUGET_KEY }}

jobs:
patch_release_to_nuget:
runs-on: ubuntu-latest

steps:
- name: Setup NuGet
uses: nuget/setup-nuget@v1
with:
nuget-api-key: $NUGET_API_TOKEN
nuget-version: 'latest'

- name: Check .NET info
run: dotnet --info

- name: Install dependencies
run: dotnet restore

- name: Build solution
run: |
dotnet build ./LLama/LLamaSharp.csproj -c Release --no-restore
dotnet build ./LLama.SemanticKernel/LLamaSharp.SemanticKernel.csproj -c Release --no-restore
- name: Pack packages
run: |
git fetch --unshallow;
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*";
git fetch origin;
chmod +x ./.github/prepare_release.sh
./.github/prepare_release.sh false true
- name: Upload packages artifacts
uses: actions/upload-artifact@v2
with:
name: "drop-ci-packages"
path: './temp'

- name: Push LLamaSharp packages to nuget.org
run: dotnet nuget push ./temp/LLamaSharp*.nupkg --source https://www.nuget.org -k ${{ secrets.LLAMA_SHARP_NUGET_KEY }} --skip-duplicate
28 changes: 0 additions & 28 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit f62afad

Please sign in to comment.