9
How can one get the build_number (and other build metadata) from within the after_script command in Travis-CI?
What have been tried already:
The documentation on build configuration says this, in the IRC notification section:
You also have the possibility to customize the message that will be sent to the channel(s) with a template:
notifications: irc: channels: - "irc.freenode.org#travis" - "irc.freenode.org#some-other-channel" template: - "%{repository} (%{commit}) : %{message} %{foo} " - "Build details: %{build_url}"You can interpolate the following variables:
- repository: your GitHub repo URL.
- build_number: build number.
- branch: branch build name.
- commit: shorten commit SHA
- author: commit author name.
- message: travis message to the build.
- compare_url: commit change view URL.
- build_url: URL of the build detail.
Trying to get this to work within an after_script command as below, did not work at all:
language: java
after_script:
- git commit -a -m "Committed by Travis-CI build number: %{build_number}"
It behaved as if .travis.yml file was absent/invalid (even though it did pass the Travis-CI YAML validation here).
It seems as though this should be doable, but could not find any sample that does this.
Could someone point me in the right direction?