build(src/knifehub.web): 1.6.2 -> 1.6.3 #34
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: TimeZone | |
run: | | |
echo "Before:" | |
date --iso-8601=seconds | |
ls -l /etc/localtime | |
# Setting TimeZone | |
sudo rm -f /etc/localtime | |
sudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
echo "After:" | |
ls -l /etc/localtime | |
date --iso-8601=seconds | |
shell: bash | |
- 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: | |
# TODO: 发现虽安装多个版本, 但 dotnet cli 依然会使用最新版本, | |
# 用 --framework net6.0 指定, 但最终执行仍然会由 dotnet\sdk\8.0.201 执行 | |
# 可能只能多个环境容器(不同版本)执行了, 在 GitHub Actions 中可利用 Matrix 多环境 | |
dotnet-version: | | |
6.0.100 | |
7.0.401 | |
8.0.201 | |
- name: Build | |
run: | | |
cd ./src/KnifeHub.Web | |
# win-x64 | |
dotnet publish --framework net6.0 --configuration Release --runtime win-x64 -p:PublishSingleFile=true --output ../../net6.0-win-x64 --self-contained true | |
dotnet publish --framework net7.0 --configuration Release --runtime win-x64 -p:PublishSingleFile=true --output ../../net7.0-win-x64 --self-contained true | |
dotnet publish --framework net8.0 --configuration Release --runtime win-x64 -p:PublishSingleFile=true --output ../../net8.0-win-x64 --self-contained true | |
# win-x86 | |
dotnet publish --framework net6.0 --configuration Release --runtime win-x86 -p:PublishSingleFile=true --output ../../net6.0-win-x86 --self-contained true | |
dotnet publish --framework net7.0 --configuration Release --runtime win-x86 -p:PublishSingleFile=true --output ../../net7.0-win-x86 --self-contained true | |
dotnet publish --framework net8.0 --configuration Release --runtime win-x86 -p:PublishSingleFile=true --output ../../net8.0-win-x86 --self-contained true | |
# linux-x64 | |
dotnet publish --framework net6.0 --configuration Release --runtime linux-x64 -p:PublishSingleFile=true --output ../../net6.0-linux-x64 --self-contained true | |
dotnet publish --framework net7.0 --configuration Release --runtime linux-x64 -p:PublishSingleFile=true --output ../../net7.0-linux-x64 --self-contained true | |
dotnet publish --framework net8.0 --configuration Release --runtime linux-x64 -p:PublishSingleFile=true --output ../../net8.0-linux-x64 --self-contained true | |
# linux-arm | |
dotnet publish --framework net6.0 --configuration Release --runtime linux-arm -p:PublishSingleFile=true --output ../../net6.0-linux-arm --self-contained true | |
dotnet publish --framework net7.0 --configuration Release --runtime linux-arm -p:PublishSingleFile=true --output ../../net7.0-linux-arm --self-contained true | |
dotnet publish --framework net8.0 --configuration Release --runtime linux-arm -p:PublishSingleFile=true --output ../../net8.0-linux-arm --self-contained true | |
# linux-arm64 | |
dotnet publish --framework net6.0 --configuration Release --runtime linux-arm64 -p:PublishSingleFile=true --output ../../net6.0-linux-arm64 --self-contained true | |
dotnet publish --framework net7.0 --configuration Release --runtime linux-arm64 -p:PublishSingleFile=true --output ../../net7.0-linux-arm64 --self-contained true | |
dotnet publish --framework net8.0 --configuration Release --runtime linux-arm64 -p:PublishSingleFile=true --output ../../net8.0-linux-arm64 --self-contained true | |
# osx-x64 | |
dotnet publish --framework net6.0 --configuration Release --runtime osx-x64 -p:PublishSingleFile=true --output ../../net6.0-osx-x64 --self-contained true | |
dotnet publish --framework net7.0 --configuration Release --runtime osx-x64 -p:PublishSingleFile=true --output ../../net7.0-osx-x64 --self-contained true | |
dotnet publish --framework net8.0 --configuration Release --runtime osx-x64 -p:PublishSingleFile=true --output ../../net8.0-osx-x64 --self-contained true | |
# osx.10.10-x64 | |
# error NETSDK1083: The specified RuntimeIdentifier 'osx.10.10-x64' is not recognized. See https://aka.ms/netsdk1083 | |
# dotnet publish --framework net6.0 --configuration Release --runtime osx.10.10-x64 -p:PublishSingleFile=true --output ../../net6.0-osx.10.10-x64 --self-contained true | |
# dotnet publish --framework net7.0 --configuration Release --runtime osx.10.10-x64 -p:PublishSingleFile=true --output ../../net7.0-osx.10.10-x64 --self-contained true | |
# dotnet publish --framework net8.0 --configuration Release --runtime osx.10.10-x64 -p:PublishSingleFile=true --output ../../net8.0-osx.10.10-x64 --self-contained true | |
- name: Zip the Build | |
run: | | |
# win-x64 | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-win-x64.zip ./net6.0-win-x64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-win-x64.zip ./net7.0-win-x64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-win-x64.zip ./net8.0-win-x64/ | |
# win-x86 | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-win-x86.zip ./net6.0-win-x86/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-win-x86.zip ./net7.0-win-x86/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-win-x86.zip ./net8.0-win-x86/ | |
# linux-x64 | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-linux-x64.zip ./net6.0-linux-x64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-linux-x64.zip ./net7.0-linux-x64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-linux-x64.zip ./net8.0-linux-x64/ | |
# linux-arm | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-linux-arm.zip ./net6.0-linux-arm/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-linux-arm.zip ./net7.0-linux-arm/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-linux-arm.zip ./net8.0-linux-arm/ | |
# linux-arm64 | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-linux-arm64.zip ./net6.0-linux-arm64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-linux-arm64.zip ./net7.0-linux-arm64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-linux-arm64.zip ./net8.0-linux-arm64/ | |
# osx-x64 | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-osx-x64.zip ./net6.0-osx-x64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-osx-x64.zip ./net7.0-osx-x64/ | |
zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-osx-x64.zip ./net8.0-osx-x64/ | |
# osx.10.10-x64 | |
# zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0-osx.10.10-x64.zip ./net6.0-osx.10.10-x64/ | |
# zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-osx.10.10-x64.zip ./net7.0-osx.10.10-x64/ | |
# zip -r KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-osx.10.10-x64.zip ./net8.0-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: | | |
# net6.0 | |
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 | |
# net7.0 | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-win-x64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-win-x86.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-linux-x64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-linux-arm.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-linux-arm64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-osx-x64.zip | |
# KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net7.0-osx.10.10-x64.zip | |
# net8.0 | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-win-x64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-win-x86.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-linux-x64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-linux-arm.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-linux-arm64.zip | |
KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-osx-x64.zip | |
# KnifeHub-${{ steps.vars.outputs.RELEASE_VERSION }}-net8.0-osx.10.10-x64.zip | |
README.md | |
LICENSE |