diff --git a/action.yml b/action.yml index 028357c..850af2c 100644 --- a/action.yml +++ b/action.yml @@ -1,31 +1,30 @@ -name: 'Composite Action Template' -description: 'Composite Action 範本' +name: 'DOTNET EF DATABASE MIGRATE' +description: '.NET EF 資料庫移轉' author: 'Jeffery' inputs: - runner_token: - description: 'Gitea Runner Token' + DOTNET_VERSION: + description: '使用的 .NET 版本' + default: '10.0' + PROJECT_NAME: + description: '專案名稱(包含 Microsoft.EntityFrameworkCore.Design 的專案)' + required: true + MIGRATION_PROJECT_NAME: + description: '移轉的專案名稱(包含 DbContext 的專案)' + required: true + MIGRATION_CONTEXT: + description: '移轉的資料庫元件名稱(DbContext 的名稱)' required: true - text: - description: '輸入的文字' - default: "Hello, World!" -outputs: - text: - description: '輸出的文字' - value: ${{ steps.display.outputs.text }} runs: using: 'composite' + env: + ASPNETCORE_ENVIRONMENT: "Production" steps: - - name: 顯示資訊 - id: display - env: - GITEA_SERVER_URL: ${{ gitea.server_url }} - GITEA_REPOSITORY: ${{ gitea.repository }} - RUNNER_TOKEN: ${{ inputs.runner_token }} - TEXT: ${{ inputs.text }} - run: | - echo "Gitea Server Url: $GITEA_SERVER_URL" - echo "Gitea Repository: $GITEA_REPOSITORY" - echo "Gitea Runner Token: $RUNNER_TOKEN" - echo "Input Text: $TEXT" - echo "text=$TEXT" >> "$GITHUB_OUTPUT" - shell: bash \ No newline at end of file + - name: 取得專案 + uses: actions/checkout@v6 + - name: 安裝套件 + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ inputs.DOTNET_VERSION }} + - name: 資料庫移轉 + run: dotnet ef database update --project ../${{ inputs.MIGRATION_PROJECT_NAME }} --context ${{ inputs.MIGRATION_CONTEXT }} + working-directory: ${{ inputs.PROJECT_NAME }} \ No newline at end of file