add github action

This commit is contained in:
newbe36524 2021-07-25 14:06:33 +08:00
parent 4fccef5bf9
commit 231b91aa46
7 changed files with 194 additions and 0 deletions

4
.github/labeler.yml vendored Normal file
View File

@ -0,0 +1,4 @@
# Configuration for labeler - https://github.com/actions/labeler
🛠 Improvement: FastGithub/**/*
Actions: .github/workflows/**/*

43
.github/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name-template: "v$RESOLVED_VERSION 🌈"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: "💥 Breaking Changes"
label: "💥 Breaking Change"
- title: "🌟 New Features"
label: "🌟 New Feature"
- title: "⭐ Features"
label: "⭐ Feature"
- title: "🐞 Bug Fixes"
label: "🐞 Bug Fix"
- title: "🛠 Improvements"
label: "🛠 Improvement"
- title: "🌀 External Changes"
label: "🔌 3rd Party Plugin"
- title: "📖 Documentation"
label: "📖 Docs"
- title: "🌍 Localization"
label: "🌍 i18n"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
template: |
## Changes
$CHANGES

11
.github/workflows/labeler.yml vendored Normal file
View File

@ -0,0 +1,11 @@
name: "Pull Request Labeler"
on:
- pull_request_target
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

39
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Amazing Favorites build
on:
push:
branches:
- master
- develop
- feature/ci
- feature/ut
pull_request:
branches:
- master
- develop
jobs:
build:
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
include-prerelease: true
- name: Install dependencies
run: |
cd .
dotnet restore
- name: build and test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: |
dotnet build . --configuration Release

29
.github/workflows/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Release Drafter
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

65
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,65 @@
name: Release
on:
release:
types: [published]
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
os: [win-x64, linux-x64, osx-x64]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET 3.0 for gitreleasemanager
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.x
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
include-prerelease: true
- name: Setup .NET 5.0 for Release Manager
uses: actions/setup-dotnet@v1
with:
dotnet-version: "5.0.x"
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.9
with:
versionSpec: 5.x
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.9
with:
useConfigFile: true
- name: Restore dependencies
run: |
cd $GITHUB_WORKSPACE/src
dotnet restore
- name: Build
run: |
cd $GITHUB_WORKSPACE/src
dotnet publish FastGithub -c Release -f net6.0 /p:PublishSingleFile=true /p:PublishTrimmed=true -r ${{ matrix.os }} /p:PublishTrimmed=true -p:AssemblyVersion=${{ steps.gitversion.outputs.MajorMinorPatch }} -p:Version=${{ steps.gitversion.outputs.SemVer }} -o ./out/${{ matrix.os }}
mv out/${{ matrix.os }} FastGithub-${{ matrix.os }}-${{ steps.gitversion.outputs.MajorMinorPatch }}
zip -r FastGithub-${{ matrix.os }}-${{ steps.gitversion.outputs.MajorMinorPatch }}.zip FastGithub-${{ matrix.os }}-${{ steps.gitversion.outputs.MajorMinorPatch }}
- uses: gittools/actions/gitreleasemanager/setup@v0.9.2
name: Install GitReleaseManager
with:
versionSpec: "0.11.x"
- uses: gittools/actions/gitreleasemanager/addasset@v0.9.2
name: Add asset to a release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: "newbe36524"
repository: "FastGithub"
tagName: "v${{ steps.gitversion.outputs.MajorMinorPatch }}"
assets: |
src/FastGithub-${{ matrix.os }}-${{ steps.gitversion.outputs.MajorMinorPatch }}.zip

3
GitVersion.yml Normal file
View File

@ -0,0 +1,3 @@
major-version-bump-message: "(breaking|major):"
minor-version-bump-message: "(feature|minor):"
patch-version-bump-message: "(fix|patch):"