Easy publish on CI env
Hello :)
I've open this issue on pub https://github.com/dart-lang/pub/issues/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 ?
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?
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 --forceto publish the package on pub
Is it more clear @shyndman ?
Yes. Thank you. I think this is a perfect addition.
Are you looking to contribute this functionality?
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.
is there progress here? I would like to automate pub publish as well.
It looks like pub has not yet finalized their API spec for publishing stuff (see https://github.com/dart-lang/pub/issues/1381).