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

Easy publish on CI env #23

Open
jaumard opened this issue Oct 24, 2019 · 6 comments
Open

Easy publish on CI env #23

jaumard opened this issue Oct 24, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@jaumard
Copy link

jaumard commented Oct 24, 2019

Hello :)

I've open this issue on pub dart-lang/pub#2227

But look like it will take time to be implemented properly, I think it can be done in this plugin until an official solution is available.

A pubx publish --token that will set the token into /.pub-cache/credentials.json and then forward the publish to pub.

What do you think ?

@shyndman
Copy link
Owner

shyndman commented Dec 27, 2019

Hi @jaumard,

I'm sorry. I just saw this now. I have to figure out my notification prefs.

Can you describe the command in full? What it's for, how it works, what are its options, etc?

@shyndman shyndman added the enhancement New feature or request label Dec 27, 2019
@jaumard
Copy link
Author

jaumard commented Dec 27, 2019

No problem :)

So I have some repo where I want to have automatic deployment in when I'm pushing a new tag for exemple, currently it's not really easy as we have to manually push our login/token into /.pub-cache/credentials.json to make the pub publish to work. If not it ask for a login and it's not possible on CI.

Here is what I have in my /.pub-cache/credentials.json:

{
  "accessToken": "TOKEN_VALUE",
  "refreshToken": "REFRESH_TOKEN_VALUE",
  "tokenEndpoint": "https://accounts.google.com/o/oauth2/token",
  "scopes": [
    "openid",
    "https://www.googleapis.com/auth/userinfo.email"
  ],
  "expiration": 1576674549551
}

So until pub give us an easy way to publish on ci we can have this command that create the /.pub-cache/credentials.json with that content and fill the accessToken and refreshToken (maybe update the expiration to always have a valid value)

So my idea is to have a command like:

pubx publish --access-token MY_SUPER_TOKEN --refresh-token MY_REFRESH_TOKEN

That command has two step to do:

  • Create/override /.pub-cache/credentials.json
  • call pub publish --force to publish the package on pub

Is it more clear @shyndman ?

@shyndman
Copy link
Owner

shyndman commented Dec 27, 2019

Yes. Thank you. I think this is a perfect addition.

Are you looking to contribute this functionality?

@shyndman
Copy link
Owner

One thought about --force: maybe we want to keep that option as well, and forward it along?

In its absence, fail the command with a non-zero exit if there are errors, so CI can be aware of any problems.

@AKushWarrior
Copy link

is there progress here? I would like to automate pub publish as well.

@tianhaoz95
Copy link

It looks like pub has not yet finalized their API spec for publishing stuff (see dart-lang/pub#1381).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants