How can I dart pub publish on travis ci deploy


I would like to know if anyone can provide a nice answer to:

How can I publish a dart package on during the deploy step, for example on a certain tag or even specified branch?

I have figured that I can run a script as a provider but I assume that the access token is required for pub I guess? Its not super clear so then I decided to ask here. For even more detailed context, my project is here and I would like to tag a release and have it publish like npm release.



Thanks to the comments I found that the following did solve the issue…

  1. Added a section to the .travis.yml to set the deploy script, I changed to branch just for this example since I messed up the tag example
    provider: script
    script: ./tool/
      branch: master
  1. Setup some that writes the json out
#!/usr/bin/env bash
mkdir -p .pub-cache

cat <<EOF > ~/.pub-cache/credentials.json

pub publish -f
  1. Set the env variables in travis settings for the repo with the show in build disabled.

Only thing now is if it will work after expiry…

Answered By – LTeacher

Answer Checked By – David Goodson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.