Skip to content

Commit

Permalink
Update steps to generate AWS ECS
Browse files Browse the repository at this point in the history
  • Loading branch information
byhbt committed Jan 6, 2022
1 parent d8c4567 commit b99cedb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
24 changes: 13 additions & 11 deletions lib/nimble_template/addons/github.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ 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(
[
{: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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/nimble_template/helpers/github.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 5 additions & 7 deletions lib/nimble_template/variants/phoenix/template.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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, %{
Expand All @@ -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

Expand Down

0 comments on commit b99cedb

Please sign in to comment.