Files
dotnet-migrate/action.yml
T
jiantw83 90b76e2a74 更新 action.yml
fix: 修正環境變數要判斷的參數
2026-05-06 03:10:16 +00:00

34 lines
1.1 KiB
YAML

name: 'DOTNET EF DATABASE MIGRATE'
description: '.NET EF 資料庫移轉'
author: 'Jeffery'
inputs:
DOTNET_VERSION:
description: '使用的 .NET 版本'
default: '10.0'
DOTNET_ENVIRONMENT:
description: '使用的 .NET 環境名稱'
default: 'Production'
PROJECT_NAME:
description: '專案名稱(包含 Microsoft.EntityFrameworkCore.Design 的專案)'
required: true
MIGRATION_PROJECT_NAME:
description: '移轉的專案名稱(包含 DbContext 的專案)'
required: true
MIGRATION_CONTEXT:
description: '移轉的資料庫元件名稱(DbContext 的名稱)'
required: true
runs:
using: 'composite'
steps:
- name: 取得專案
uses: actions/checkout@v6
- name: 安裝套件
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.DOTNET_VERSION }}
- name: 資料庫移轉
env:
ASPNETCORE_ENVIRONMENT: ${{ 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 }}