Skip to content

Fix submodule doesn't update when create release#220

Closed
numbcoder wants to merge 1 commit intomattbrictson:mainfrom
numbcoder:main
Closed

Fix submodule doesn't update when create release#220
numbcoder wants to merge 1 commit intomattbrictson:mainfrom
numbcoder:main

Conversation

@numbcoder
Copy link
Copy Markdown

Fix #219

Copy link
Copy Markdown
Owner

@mattbrictson mattbrictson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable, but as the sole maintainer of tomo and someone who has never used submodules in a production capacity, I am not comfortable including this in the default tomo git plugin.

As a result, I am going to close this PR.

However, for those interested in using this code in their own tomo projects, you can implement it as follows:

1. Create a plugin local to your project.

# .tomo/plugins/submodule.rb

def update_and_init
  remote.chdir(paths.release) do
    remote.git("--work-tree=. --git-dir=#{paths.git_repo} submodule update --init --recursive --depth=1")
  end
end

2. Load the plugin in your config file

# .tomo/config.rb

plugin "./plugins/submodule"

3. Add the new task right after git:create_release

setup do
  # ...
  run "git:create_release"
  run "submodule:update_and_init"

# ...

deploy do
  # ...
  run "git:create_release"
  run "submodule:update_and_init"

# ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git:create_release doesn't pull submodule

2 participants