Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mina don't support deployment by tag #296

Closed
huanzhang opened this issue Apr 1, 2015 · 3 comments
Closed

mina don't support deployment by tag #296

huanzhang opened this issue Apr 1, 2015 · 3 comments

Comments

@huanzhang
Copy link

When we prepare to release a version of our product, generally, we will create a tag on the release branch and want to deploy according to the tag. But mina does not support tag deployment something like:

set :tag, 'v1.0.1'

Could mina support this?

@13k
Copy link
Contributor

13k commented May 1, 2015

Try using set :commit, 'v1.0.1'

@czj
Copy link

czj commented Jul 1, 2015

We have the same issue with our app. We use tags to avoid creating staging branch every time we wish to deploy a specific version on the staging server.

Here is the code we used:

namespace :git do
  desc "Clones the Git repository to the release path."
  task :clone do
    queue %{
      if [ ! -d "#{deploy_to}/scm/.git" ]; then
        echo "-----> Cloning the Git repository"
        #{echo_cmd %[git clone "#{repository}" "#{deploy_to}/scm"]}
      else
        echo "-----> Fetching new git commits"
        #{echo_cmd %[cd "#{deploy_to}/scm" && git pull --all --prune --tags]}
      fi
    }

    in_directory "#{deploy_to}/scm" do
      queue %{ echo "-----> Using this git commit :" && echo }
      queue %{ #{echo_cmd %[git show -s --oneline #{branch}]} && echo }
    end

    queue %{ echo "-----> Using git branch '#{branch}'" }
    queue %{ #{echo_cmd %[git archive --format=tar "--remote=#{deploy_to}/scm" #{branch} | tar xf -]} }
  end
end

By the way, this doesn't work with a bare repository (we tried but had way too many issues).

The git archive command allows us to clone the file a in directory without deleting the .git repository afterwards.

@d4be4st
Copy link
Member

d4be4st commented Jul 5, 2015

@13k answered the question correctly. closing

@d4be4st d4be4st closed this as completed Jul 5, 2015
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

No branches or pull requests

4 participants