Browse Source

Merge pull request #215 from AsakusaRinne/auto_release_ci

ci: try to fix error of pushing package.
tags/v0.6.0
Rinne GitHub 2 years ago
parent
commit
f62afad1e8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 103 additions and 46 deletions
  1. +20
    -0
      .github/workflows/release-minor-trigger.yml
  2. +13
    -18
      .github/workflows/release-minor.yml
  3. +20
    -0
      .github/workflows/release-patch-trigger.yml
  4. +50
    -0
      .github/workflows/release-patch.yml
  5. +0
    -28
      .github/workflows/release.yml

+ 20
- 0
.github/workflows/release-minor-trigger.yml View File

@@ -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

.github/workflows/release_prepare.yml → .github/workflows/release-minor.yml View File

@@ -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:
@@ -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
- 0
.github/workflows/release-patch-trigger.yml View File

@@ -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
- 0
.github/workflows/release-patch.yml View File

@@ -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

+ 0
- 28
.github/workflows/release.yml View File

@@ -1,28 +0,0 @@
name: auto-release

on:
workflow_run:
workflows: ["release-prepare"]
types:
- completed

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

jobs:
release_to_nuget:
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: dawidd6/action-download-artifact@v2
with:
name: drop-ci-packages
workflow: release-prepare.yml
branch: master

- name: Push LLamaSharp packages to nuget.org
run: |
ls
ls ./temp
dotnet nuget push ./temp/LLamaSharp*.nupkg --source https://www.nuget.org -k ${{ secrets.LLAMA_SHARP_NUGET_KEY }} --skip-duplicate

Loading…
Cancel
Save