grind_publish 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 51

grind_publish #

This package automatically publishes your library when the pubspec.yaml version has been increased and merged into master.

NOTE: We strongly recommend to add a comment to the pubspec.yaml file to note that this package auto publishes if the version is increased. E.g.:

# Increasing this version will automatically
# publish to pub when merged into master
version: 0.0.2

Usage #

1. Setup the grind task like this: #

@Task('Automatically publishes this package if the pubspec version increases')
autoPublish() async {
  final credentials = grind_publish.Credentials.fromEnvironment();
  await grind_publish.autoPublish('your-package-name', credentials);

2. Set the environmental variables in your CI runner #

By default the env vars are named: ACCESS_TOKEN, REFRESH_TOKEN, EXPIRATION, TOKEN_ENDPOINT (optional), SCOPES (optional).

You find the values on your local machine in ~/.pub-cache/credentials.json after you once ran pub publish.

On GitLab, setting these variables is in Settings → CI / CD → Variables.

3. Run the script in your CI pipeline #

This really depends on where you are running this. For GitLab example, simply look at this .gitlab-ci.yml.

License #


Changelog #

1.0.0 #

  • Upgrade dependencies, fix all hints.

0.0.5 #

  • Upgrade dependencies.

0.0.4 #

  • Make use of the pub_client library to read the latest version.

0.0.3 #

  • Add analysis_options and make sure to await autoPublish.

0.0.2 #

  • Fix issue when optional env vars haven't been set.

0.0.1 #

  • Initial Release


import 'package:grinder/grinder.dart';
import 'package:grind_publish/grind_publish.dart' as grind_publish;

@Task('Automatically publishes this package if the pubspec version increases')
void autoPublish() async {
  // Will use the `ACCESS_TOKEN`, `REFRESH_TOKEN` and `EXPIRATION` env vars
  // as a configuration.
  final credentials = grind_publish.Credentials.fromEnvironment();

  await grind_publish.autoPublish('your-package-name', credentials);

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  grind_publish: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:grind_publish/grind_publish.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
grinder ^0.8.3 0.8.4
http ^0.12.0 0.12.0+4
meta ^1.1.0 1.1.8
path ^1.6.0 1.6.4
pub_client ^3.0.3 3.0.3
yaml ^2.1.0 2.2.0
Transitive dependencies
async 2.4.1
charcode 1.1.3
cli_util 0.1.3+2
collection 1.14.12
glob 1.2.0
http_parser 3.1.4
js 0.6.1+1
json_annotation 2.4.0 3.0.1
node_interop 1.0.3
node_io 1.0.1+2
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
logging ^0.11.3
pedantic ^1.9.0 1.9.0
test ^1.3.0