feat(.github,src/knifehub.web): knifeHub-release.yml, KnifeHub.Web #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: KnifeHub Release | |
on: | |
push: | |
tags: | |
- "KnifeHub-v*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
with: | |
# 为了让 git 有日志 (git log) 可寻,还得在检出的时候顺带把所有提交历史一并拉下来,指定 fetch-depth 就能做到 | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Set outputs | |
id: vars | |
run: | | |
tagPrefix=refs/tags/KnifeHub- | |
# 获取字符串长度 | |
tagPrefixLen=${#tagPrefix} | |
# 去掉前面的 refs/tags/KnifeHub- | |
RELEASE_VERSION=${GITHUB_REF:$tagPrefixLen} | |
# 提取出 v1.0.0 | |
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: | | |
6.0.100 | |
7.0.401 | |
- name: Build | |
run: | | |
cd ./src/KnifeHub.Web | |
# win-x64 | |
dotnet publish --framework net6.0 --configuration Release --runtime win-x64 -p:PublishSingleFile=true --output ../../win-x64 --self-contained true | |
# win-x86 | |
dotnet publish --framework net6.0 --configuration Release --runtime win-x86 -p:PublishSingleFile=true --output ../../win-x86 --self-contained true | |
# linux-x64 | |
dotnet publish --framework net6.0 --configuration Release --runtime linux-x64 -p:PublishSingleFile=true --output ../../linux-x64 --self-contained true | |
# linux-arm | |
dotnet publish --framework net6.0 --configuration Release --runtime linux-arm -p:PublishSingleFile=true --output ../../linux-arm --self-contained true | |
# linux-arm64 | |
dotnet publish --framework net6.0 --configuration Release --runtime linux-arm64 -p:PublishSingleFile=true --output ../../linux-arm64 --self-contained true | |
# osx-x64 | |
dotnet publish --framework net6.0 --configuration Release --runtime osx-x64 -p:PublishSingleFile=true --output ../../osx-x64 --self-contained true | |
# osx.10.10-x64 | |
dotnet publish --framework net6.0 --configuration Release --runtime osx.10.10-x64 -p:PublishSingleFile=true --output ../../osx.10.10-x64 --self-contained true | |
- name: Zip the Build | |
run: | | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-win-x64.zip ./win-x64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-win-x86.zip ./win-x86/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-linux-x64.zip ./linux-x64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-linux-arm.zip ./linux-arm/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-linux-arm64.zip ./linux-arm64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-osx-x64.zip ./osx-x64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-osx.10.10-x64.zip ./osx.10.10-x64/ | |
- name: Create temp-release-note.md | |
run: | | |
cp utils/generate-release-note.ps1 generate-release-note.ps1 | |
$env:GitProjectTagName="KnifeHub" | |
$env:GitProjectPath="src/KnifeHub.Web/*" | |
./generate-release-note.ps1 | |
shell: pwsh | |
- name: Create Release and Upload Release Asset | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
#tag_name: ${{ github.ref }} | |
#name: ${{ github.ref }} | |
# body: TODO New Release. | |
body_path: temp-release-note.md | |
draft: false | |
prerelease: false | |
files: | | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-win-x64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-win-x86.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-linux-x64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-linux-arm.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-linux-arm64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-osx-x64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-osx.10.10-x64.zip |