73 lines
1.8 KiB
YAML
73 lines
1.8 KiB
YAML
name: aspnet
|
|
description: build aspnet
|
|
author: qxa
|
|
inputs:
|
|
project_name:
|
|
description: 要编译的项目名称
|
|
required: true
|
|
configuration:
|
|
description: 发布所对应的配置,默认值为 "Debug"
|
|
required: false
|
|
default: Release
|
|
runtime:
|
|
description: 要发布的目标运行时。在创建自包含部署时使用
|
|
required: false
|
|
os:
|
|
description: 目标操作系统
|
|
required: false
|
|
publish:
|
|
description: 输出目录
|
|
required: false
|
|
default: publish
|
|
nuget_dir:
|
|
description: nuget包还原地址,如需缓存请挂载目录
|
|
required: false
|
|
default: /opt/hostedtoolcache/.nuget/packages
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: 给脚本配置权限
|
|
shell: bash
|
|
env:
|
|
script: |
|
|
#! /bin/bash
|
|
|
|
option="--no-self-contained -o $INPUT_PUBLISH -c $INPUT_CONFIGURATION"
|
|
|
|
if [ -n "$INPUT_RUNTIME" ]; then
|
|
option="$option -r $INPUT_RUNTIME"
|
|
fi
|
|
|
|
if [ -n "$INPUT_OS" ]; then
|
|
option="$option --os $INPUT_OS"
|
|
fi
|
|
|
|
echo "option=$option"
|
|
|
|
dotnet --version
|
|
|
|
dotnet restore $INPUT_PROJECT_NAME --packages ${{ inputs.nuget_dir }}
|
|
dotnet build $INPUT_PROJECT_NAME --packages ${{ inputs.nuget_dir }}
|
|
dotnet publish $option $INPUT_PROJECT_NAME --packages ${{ inputs.nuget_dir }}
|
|
|
|
run: |
|
|
echo "$script">entrypoint.sh
|
|
chmod +x entrypoint.sh
|
|
|
|
- name: 在docker中编译
|
|
uses: docker://dotnet/sdk:8.0
|
|
with:
|
|
entrypoint: ./entrypoint.sh
|
|
|
|
project_name: ${{ inputs.project_name }}
|
|
configuration: ${{ inputs.configuration }}
|
|
runtime: ${{ inputs.runtime }}
|
|
os: ${{ inputs.os }}
|
|
publish: ${{ inputs.publish }}
|
|
|
|
- name: 删除文件
|
|
shell: bash
|
|
run: |
|
|
rm -f entrypoint.sh
|