submodule对gitea不管用,所以直接拉了一份拉格兰

This commit is contained in:
2025-02-04 16:29:43 +08:00
parent b0bfc803e3
commit d149a2ea0f
1023 changed files with 43308 additions and 18 deletions

View File

@@ -0,0 +1,39 @@
name: Lagrange.Core NuGet Push
on:
push:
branches:
- master
paths:
- "Lagrange.Core/**"
- "Lagrange.Core.sln"
- "LICENSE"
- "README.md"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Pack
run: |
dotnet build -c Release Lagrange.Core
dotnet pack -c Release Lagrange.Core
dotnet pack -c Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg Lagrange.Core
- name: Add private GitHub registry to NuGet
run: dotnet nuget add source --username Linwenxuan05 --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/LagrangeDev/index.json"
- name: Push generated package to GitHub registry
run: dotnet nuget push ./Lagrange.Core/bin/Release/*.nupkg --source "github" --skip-duplicate --api-key ${{ secrets.GIT_TOKEN }}
- name: Push generated package to NuGet
run: dotnet nuget push ./Lagrange.Core/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{ secrets.NUGETAPIKEY }}

View File

@@ -0,0 +1,72 @@
name: Lagrange.OneBot Build
on:
push:
branches:
- master
paths:
- "Lagrange.Core/**"
- "Lagrange.OneBot/**"
- "Lagrange.Core.sln"
- "LICENSE"
- "!Lagrange.OneBot/Resources/Dockerfile"
- "!Lagrange.OneBot/Resources/docker-entrypoint.sh"
pull_request:
branches:
- master
paths:
- "Lagrange.Core/**"
- "Lagrange.OneBot/**"
- "Lagrange.Core.sln"
- "LICENSE"
- "!Lagrange.OneBot/Resources/Dockerfile"
- "!Lagrange.OneBot/Resources/docker-entrypoint.sh"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
runtimeIdentifier:
[
win-x64,
win-x86,
linux-x64,
linux-arm,
linux-arm64,
osx-x64,
osx-arm64,
linux-musl-x64,
linux-musl-arm,
linux-musl-arm64,
]
steps:
- uses: actions/checkout@v4
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Build Lagrange.OneBot .NET 8.0
run: dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj --no-self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net8.0
- name: Build Lagrange.OneBot .NET 9.0
run: dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj --no-self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net9.0
- name: Upload binary files(${{ matrix.runtimeIdentifier }}) for .NET 8.0
uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request'
with:
name: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_net8.0_NoSelfContained
path: Lagrange.OneBot/bin/Release/net8.0/${{ matrix.runtimeIdentifier }}/publish
- name: Upload binary files(${{ matrix.runtimeIdentifier }}) for .NET 9.0
uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request'
with:
name: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_net9.0_NoSelfContained
path: Lagrange.OneBot/bin/Release/net9.0/${{ matrix.runtimeIdentifier }}/publish

View File

@@ -0,0 +1,62 @@
name: Lagrange.OneBot Docker Push
on:
push:
branches:
- master
paths:
- "Lagrange.Core/**"
- "Lagrange.OneBot/**"
- "Lagrange.Core.sln"
- "LICENSE"
pull_request:
branches:
- master
paths:
- "Lagrange.Core/**"
- "Lagrange.OneBot/**"
- "Lagrange.Core.sln"
- "LICENSE"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Registry
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GIT_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/lagrange.onebot
tags: |
type=edge
type=sha,event=branch
type=ref,event=tag
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: "Lagrange.OneBot/Resources/Dockerfile"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64, linux/arm

View File

@@ -0,0 +1,76 @@
name: Lagrange.OneBot Release
on:
workflow_dispatch:
env:
GH_TOKEN: ${{ github.token }}
jobs:
delete-tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- run: gh release delete nightly --cleanup-tag -y -R ${{ github.repository }}
create-tag:
needs:
- delete-tag
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- run: echo -e "> ⚠This is a nightly release.\r\n> ⚠This is not the latest version." > note
- run: gh release create nightly -F ./note -p -t "Nightly Release" -R ${{ github.repository }}
build-and-upload-release:
if: ${{ always() }}
needs:
- create-tag
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
runtimeIdentifier:
[
win-x64,
win-x86,
linux-x64,
linux-arm,
linux-arm64,
osx-x64,
osx-arm64,
linux-musl-x64,
linux-musl-arm,
linux-musl-arm64,
]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- run: dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj --self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net9.0
- run: |
if [[ ${{ matrix.runtimeIdentifier }} == 'win-x64' || ${{ matrix.runtimeIdentifier }} == 'win-x86' ]]; then
zip -r Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_net9.0_SelfContained.zip ./Lagrange.OneBot/bin/Release/net9.0/${{ matrix.runtimeIdentifier }}/publish
gh release upload nightly Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_net9.0_SelfContained.zip -R ${{ github.repository }}
else
tar -czvf Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_net9.0_SelfContained.tar.gz ./Lagrange.OneBot/bin/Release/net9.0/${{ matrix.runtimeIdentifier }}/publish
gh release upload nightly Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_net9.0_SelfContained.tar.gz -R ${{ github.repository }}
fi