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

Custom deploy message for gh-pages #913

Open
dcastil opened this Issue Mar 2, 2018 · 11 comments

Comments

Projects
None yet
7 participants
@dcastil

dcastil commented Mar 2, 2018

I try to change the default commit message for gh-pages to one with an environment variable of the build. My deploy configuration in .travis.yml looks like this:

deploy:
  provider: pages
  skip-cleanup: true
  local-dir: build
  github-token: $GITHUB_TOKEN
  keep-history: true
  commit_message: "Deploy release ${TRAVIS_TAG}"
  on:
    branch: master
    tags: true

But Travis is still deploying with the default commit message and I couldn't find any solution to this after further research. Am I missing something?

@BanzaiMan

This comment has been minimized.

Member

BanzaiMan commented Mar 3, 2018

At the moment, the pages provider does not provide you with means to do that.

@dcastil

This comment has been minimized.

dcastil commented Mar 6, 2018

Oh, what a pity. But thanks for the reply!

@dcastil dcastil closed this Mar 6, 2018

@Kristinita

This comment has been minimized.

Kristinita commented Mar 13, 2018

+1.

In past I deploy my site to GitHub Pages, use .sh script. Part of script:

commitHash=$(git rev-parse HEAD)
commitMessage=$(git log -1 --pretty=%B)
detailedMessage="Commit https://github.com/$TRAVIS_REPO_SLUG/commit/$commitHash pushed to GitHub Pages by Travis CI build $TRAVIS_BUILD_NUMBER — https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID"
git commit -m "$commitMessage" -m "$detailedMessage"

Result:

Custom commit message

It would be nice, if would be possible similar commit messages

Thanks.

@BanzaiMan

This comment has been minimized.

Member

BanzaiMan commented Mar 14, 2018

Reopening to see if anyone is interested in adding this feature.

@BanzaiMan BanzaiMan reopened this Mar 14, 2018

@BanzaiMan

This comment has been minimized.

Member

BanzaiMan commented Mar 14, 2018

The code is here:

def github_commit
committer_name, _ = identify_preferred_committer
print_step "Preparing to deploy #{@target_branch} branch to gh-pages (workdir: #{Dir.pwd})"
context.shell "touch \"deployed at `date` by #{committer_name}\"" if @deployment_file
context.shell "echo '#{@gh_fqdn}' > CNAME" if @gh_fqdn
context.shell 'git add -A .'
context.shell "git commit#{@git_commit_opts} -qm 'Deploy #{@project_name} to #{@gh_ref}:#{@target_branch}'"
context.shell 'git show --stat-count=10 HEAD'
end

Some care would be necessary to pass correctly escaped string to do the job.

@diegoferigo

This comment has been minimized.

diegoferigo commented Apr 1, 2018

Interested as well in this feature! It would be awesome to have the possibility of specifying a custom message, when done manually I always used something similar as @Kristinita comment, which includes:

  • last commit SHA-1
  • TRAVIS_BUILD_NUMBER

It actually would be enough to allow committing from the before_deploy step, and then the deploy pipeline only has to push the changes. The current implementation though creates the folder in /tmp after before_deploy.

@pexcn

This comment has been minimized.

pexcn commented Apr 7, 2018

I hope add this option:

commit_message: "[AUTO BUILD] `date +'%Y-%m-%d %T'`"    # support the commands

then commit message like:

[AUTO BUILD] 2018-04-07 22:29:06

sarahdayan referenced this issue in sarahdayan/dpl Jun 18, 2018

@sarahdayan

This comment has been minimized.

sarahdayan commented Jun 18, 2018

I've opened an PR to add this feature: #824

I'm not well-versed in Ruby so this may not be optimal, but I'm willing to get better so shoot your suggestions if you have any 🙂

@stale

This comment has been minimized.

stale bot commented Sep 16, 2018

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue in 24 hours. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please do feel free to either reopen this issue or open a new one. We'll gladly take a look again! You can read more here: https://blog.travis-ci.com/2018-03-09-closing-old-issues

@salmanulfarzy

This comment has been minimized.

salmanulfarzy commented Sep 17, 2018

PR awaiting review at #824

@BanzaiMan

This comment has been minimized.

Member

BanzaiMan commented Sep 17, 2018

The PR needs testing.

@BanzaiMan BanzaiMan transferred this issue from travis-ci/travis-ci Nov 8, 2018

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