diff --git a/Makefile b/Makefile index 3e486a9f..99969b7c 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,6 @@ create_mix_project: # Y - in response to Will you host this project on Github? # Y - in response to Do you want to generate the .github/ISSUE_TEMPLATE and .github/PULL_REQUEST_TEMPLATE? # Y - in response to Do you want to generate the Github Action workflows: Test? -# Y - in response to Do you want to generate the Github Action workflows: Deploy to Heroku? # Y - in response to Do you want to generate the .github/.workflow/README file? # Y - in response to Do you want to publish a Github Wiki for this project? You'd need to manually create the first Github Wiki Page and set the GH_TOKEN and GH_EMAIL secret for this to properly function. # Y - in response to Do you want to generate the Github Action workflows: Deploy to Heroku? diff --git a/lib/nimble_template/addons/github.ex b/lib/nimble_template/addons/github.ex index e2159cd5..b4ff95ba 100644 --- a/lib/nimble_template/addons/github.ex +++ b/lib/nimble_template/addons/github.ex @@ -59,7 +59,8 @@ defmodule NimbleTemplate.Addons.Github do %{ github_workflows_readme: true, with_test_workflow?: with_test_workflow?, - with_deploy_to_heroku_workflow?: with_deploy_to_heroku_workflow? + with_deploy_to_heroku_workflow?: with_deploy_to_heroku_workflow?, + with_deploy_to_aws_ecs_workflow?: with_deploy_to_aws_ecs_workflow? } ) do Generator.copy_file( @@ -67,7 +68,8 @@ defmodule NimbleTemplate.Addons.Github do {:eex, ".github/workflows/README.md.eex", ".github/workflows/README.md"} ], with_test_workflow?: with_test_workflow?, - with_deploy_to_heroku_workflow?: with_deploy_to_heroku_workflow? + with_deploy_to_heroku_workflow?: with_deploy_to_heroku_workflow?, + with_deploy_to_aws_ecs_workflow?: with_deploy_to_aws_ecs_workflow? ) project @@ -83,20 +85,20 @@ defmodule NimbleTemplate.Addons.Github do end @impl true - def do_apply(%Project{} = project, %{github_wiki: true}) do - project - |> copy_wiki_files() - |> append_wiki_into_readme() + def do_apply(%Project{mix_project?: false} = project, %{github_action_deploy_aws_ecs: true}) do + Generator.copy_file([ + {:eex, ".github/workflows/deploy_to_aws_ecs.yml.eex", + ".github/workflows/deploy_to_aws_ecs.yml"} + ]) project end @impl true - def do_apply(%Project{} = project, opts) when opts.github_action_deploy_aws_ecs do - Generator.copy_file([ - {:eex, ".github/workflows/deploy_to_aws_ecs.yml.eex", - ".github/workflows/deploy_to_aws_ecs.yml"} - ]) + def do_apply(%Project{} = project, %{github_wiki: true}) do + project + |> copy_wiki_files() + |> append_wiki_into_readme() project end diff --git a/lib/nimble_template/helpers/github.ex b/lib/nimble_template/helpers/github.ex index a3052ea8..cc4f920a 100644 --- a/lib/nimble_template/helpers/github.ex +++ b/lib/nimble_template/helpers/github.ex @@ -26,5 +26,5 @@ defmodule NimbleTemplate.GithubHelper do do: Mix.shell().yes?("\nDo you want to generate the Github Action workflows: Deploy to Heroku?") def generate_github_action_deploy_aws_ecs?(), - do: Mix.shell().yes?("\nDo you want to generate the Github Action to deploy to AWS ECS?") + do: Mix.shell().yes?("\nDo you want to generate the Github Action workflows: Deploy to AWS ECS?") end diff --git a/lib/nimble_template/variants/phoenix/template.ex b/lib/nimble_template/variants/phoenix/template.ex index edf8d0f2..03afa7e8 100644 --- a/lib/nimble_template/variants/phoenix/template.ex +++ b/lib/nimble_template/variants/phoenix/template.ex @@ -52,11 +52,15 @@ defmodule NimbleTemplate.Phoenix.Template do do: Addons.Github.apply(project, %{github_action_test: true}) generate_github_action_deploy_heroku? = generate_github_action_deploy_heroku?() - generate_github_action_deploy_aws_ecs? = generate_github_action_deploy_heroku?() if generate_github_action_deploy_heroku?, do: Addons.Github.apply(project, %{github_action_deploy_heroku: true}) + generate_github_action_deploy_aws_ecs? = generate_github_action_deploy_aws_ecs?() + + if generate_github_action_deploy_aws_ecs?, + do: Addons.Github.apply(project, %{github_action_deploy_aws_ecs: true}) + if generate_github_workflows_readme?(), do: Addons.Github.apply(project, %{ @@ -69,12 +73,6 @@ defmodule NimbleTemplate.Phoenix.Template do if generate_github_wiki?(), do: Addons.Github.apply(project, %{github_wiki: true}) - if generate_github_action_deploy_heroku?, - do: Addons.Github.apply(project, %{github_action_deploy_heroku: true}) - - if generate_github_action_deploy_aws_ecs?, - do: Addons.Github.apply(project, %{github_action_deploy_aws_ecs: true}) - project end