2 Commits

Author SHA1 Message Date
jiantw83 eaae39ac07 更新 action.yml
如果沒有環境變數 ASPNETCORE_ENVIRONMENT,則從 inputs 取得
2026-05-06 03:02:33 +00:00
Jeffery 8c3850bd2d feat: 加入 DOTNET_ENVIRONMENT 參數
Co-authored-by: Copilot <copilot@github.com>
2026-05-06 09:49:58 +08:00
+7 -3
View File
@@ -5,6 +5,9 @@ inputs:
DOTNET_VERSION:
description: '使用的 .NET 版本'
default: '10.0'
DOTNET_ENVIRONMENT:
description: '使用的 .NET 環境名稱'
default: 'Production'
PROJECT_NAME:
description: '專案名稱(包含 Microsoft.EntityFrameworkCore.Design 的專案)'
required: true
@@ -16,15 +19,16 @@ inputs:
required: true
runs:
using: 'composite'
env:
ASPNETCORE_ENVIRONMENT: "Production"
steps:
- name: 取得專案
uses: actions/checkout@v6
- name: 安裝套件
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.DOTNET_VERSION }}
dotnet-version: ${{ ASPNETCORE_ENVIRONMENT || inputs.DOTNET_VERSION }}
- name: 資料庫移轉
env:
ASPNETCORE_ENVIRONMENT: ${{ inputs.DOTNET_ENVIRONMENT }}
run: dotnet ef database update --project ../${{ inputs.MIGRATION_PROJECT_NAME }} --context ${{ inputs.MIGRATION_CONTEXT }}
shell: bash
working-directory: ${{ inputs.PROJECT_NAME }}