Skip to content

Commit

Permalink
Updates doc and workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gehongyan committed Nov 15, 2022
1 parent a9a9cc8 commit ee2cff4
Show file tree
Hide file tree
Showing 49 changed files with 418 additions and 141 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Kook.Net Test

on:
workflow_call:
inputs:
target:
description: 'Targeting OS'
required: true
type: string
dotnet-version:
description: '.NET version'
required: true
type: string

jobs:
build_and_test:
name: Build and Test
runs-on: ${{ inputs.target }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'Kook.Net.targets') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Restore Dependencies
run: dotnet restore src

- name: Build
run: dotnet build src --no-restore

- name: Test
run: dotnet test src --no-build --verbosity normal --filter Category!=Integration --blame-hang-timeout 15min
90 changes: 0 additions & 90 deletions .github/workflows/deploy.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/dev.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Kook.Net Documentation

on:
workflow_call:
inputs:
dotnet-version:
description: '.NET version'
required: true
type: string
secrets:
DOC_DEPLOY_KEY:
description: 'NuGet API Key'
required: true

jobs:
doc:
name: Publish Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'Kook.Net.targets') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Restore Dependencies
run: dotnet restore src

- name: Build
run: dotnet build src --no-restore

- uses: nikeee/[email protected]
name: Build Doc
with:
args: ./docs/docfx.json

- uses: finnp/create-file-action@master
name: Add CNAME
env:
FILE_NAME: "docs/_site/CNAME"
FILE_DATA: "kooknet.dev"

- name: Publish Doc
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.DOC_DEPLOY_KEY }}
with:
source-directory: docs/_site/
destination-github-username: gehongyan
destination-repository-username: gehongyan
destination-repository-name: Kook.Net.Doc
target-directory: docs
user-email: [email protected]
56 changes: 56 additions & 0 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Kook.Net Packages

on:
workflow_call:
inputs:
dotnet-version:
description: '.NET version'
required: true
type: string
secrets:
NUGET_API_KEY:
description: 'NuGet API Key'
required: true
GITHUB_PACKAGES_KEY:
description: 'GitHub API Key'
required: true

jobs:
push_packages:
name: Push Packages
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'Kook.Net.targets') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Generate Packages
run: dotnet pack src --configuration Release --output packages

- name: Push Packages to NuGet
run: dotnet nuget push .\packages\*.nupkg -k $env:NUGET_API_KEY -s https://api.nuget.org/v3/index.json --skip-duplicate
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

- name: Push Packages to Github
run: dotnet nuget push .\packages\*.nupkg -k $env:GITHUB_PACKAGES_KEY -s https://nuget.pkg.github.com/gehongyan/index.json --skip-duplicate
env:
GITHUB_PACKAGES_KEY: ${{ secrets.GITHUB_PACKAGES_KEY }}

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Packages
path: ./packages/
28 changes: 28 additions & 0 deletions .github/workflows/push-or-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Kook.Net on Push or Pull Request

on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]

jobs:
build_and_test:
name: Build and Test
strategy:
matrix:
target: [ windows-latest, ubuntu-latest, macOS-latest ]
uses: ./.github/workflows/build-test.yml
with:
target: ${{ matrix.target }}
dotnet-version: 7.0.x

call_push_packages:
name: Push Packages
needs: build_and_test
uses: ./.github/workflows/packages.yml
with:
dotnet-version: 7.0.x
secrets:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
GITHUB_PACKAGES_KEY: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Kook.Net on Release

on:
release:
types: [ published ]

jobs:
build_and_test:
name: Build and Test
strategy:
matrix:
target: [ windows-latest, ubuntu-latest, macOS-latest ]
uses: ./.github/workflows/build-test.yml
with:
target: ${{ matrix.target }}
dotnet-version: 7.0.x

call_doc:
name: Generate Documentation
needs: build_and_test
uses: ./.github/workflows/doc.yml
with:
dotnet-version: 7.0.x
secrets:
DOC_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

---

## v0.1.0 [2022-11-15]

Initial release.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ for portion of the code in this repository according to [this license](https://g

Special thanks to [Discord.Net](https://github.com/discord-net/Discord.Net) for such a great project.

<img src="./assets/JetBrains_Logo.svg" height="50"/>
<img src="./assets/Rider_Icon.svg" height="50"/>
<img src="./assets/ReSharper_Icon.png" height="50"/>

Special thanks to [JetBrains](https://www.jetbrains.com) for providing free licenses for their awesome tools -
[Rider](https://www.jetbrains.com/rider/) and [ReSharper](https://www.jetbrains.com/resharper/).
Binary file added assets/ReSharper_Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
11 changes: 11 additions & 0 deletions docs/changelog/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
uid: Changelog
title: 变更日志
---


# 变更日志

## v0.1.0 [2022-11-15]

首次发布。
2 changes: 2 additions & 0 deletions docs/changelog/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: 变更日志
topicUid: Changelog
Loading

0 comments on commit ee2cff4

Please sign in to comment.