Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: try to fix error of pushing package. #215

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading