release 0.1.5
release: ^0.1.5 copied to clipboard
A small utility that allows to easily update your pubspec and your Github tags on new releases.
📦 release
utility #
The release
utility is, as its name suggests, a small command-line tool that helps you quickly
release your Dart apps.
It takes care of :
- Reading the pubspec.yaml file to find the current version.
- Detecting changes since the last
release
run. - Bumping the version and version code, including marking breaking changes.
- Writing the changes to the CHANGELOG.md file.
- Updating both pubspec.yaml and snap/snapcraft.yaml.
- Committing and pushing the changes.
- Creating a Github release, or just a tag if the release fails.
- Publishing to pub.flutter-io.cn, if no
publish_to: none
is specified in the pubspec.yaml.
Also : almost everything is configurable.
Warning
Currently, release
has only been tested on Windows. Feel free to try it on other platforms and
share your feedback !
Getting Started #
Installation #
For most users, simply run the following commands :
dart pub add dev:release
dart pub get
Note
You can add it as a regular dependency by removing the dev:
prefix. This will allow you to use
the Release
class
directly in your code.
Usage #
It's as simple as :
dart run release
The utility will guide you through the release process. Note that in order to generate your
CHANGELOG.md file, release
requires your commits to follow the
Conventional Commits format.
Here is an example output :
Example
D:\Projects\Flutter\Project>dart run release
Building package executable...
Built release:release.
Successfully read pubspec.yaml.
Current version is "0.1.0".
Last tag is "0.1.0".
Found no breaking change.
Proposed new version is "0.1.1", enter "Y" to continue or type a new version proposal. Type "N" to cancel. Y
Enter a comma separated list of scopes to ignore (default is "docs,version,deps") or "Y" to continue. Y
Writing changelog content...
Done.
Writing version to "pubspec.yaml" and running `flutter pub get`...
Done.
Do you want to commit the changes ? (Y/N) Y
Committing changes...
Done.
Do you want to push the changes ? (Y/N) Y
Pushing...
Done.
Do you want to create a Github release ? (Y/N) Y
Creating a release on Github...
Done.
Fetching tags...
Done.
Do you want to publish the new version on pub.flutter-io.cn ? (Y/N) Y
Publishing...
Done.
Configuration #
You can configure the release
utility directly in your pubspec.yaml file.
Here's an example :
name: my_app
description: my_app_description
version: 0.0.1
repository: https://github.com/me/my_app
# Other values, like dependencies and dev dependencies.
# See https://pub.flutter-io.cn/documentation/release/latest/release/ReleaseConfig-class.html for more details.
release:
changelog:
header: '# 📰 my_app changelog'
defaultIgnoredScopes: ['docs', 'version', 'deps'] # This is the default.
defaultIgnoredTypes: ['test'] # This is the default.
# Entries are processed using the Liquid template engine.
entry:
title: '## v{{ version }}' # This is the default.
header: 'Released on {{ date | date: "MMMM d, yyyy" }}.' # This is the default.
item: '* **{% if breaking %}BREAKING {% endif %}{{ type | upcase }}**: {{ description }} ({% if repo %}[#{{ hash }}](https://github.com/{{ repo }}/commit/{{ hash }}){% else %}#{{ hash }}{% endif %})' # This is the default.
git:
github: https://github.com/me/my_app # Alternative to top-level `repository`.
newVersionCommitMessage: 'chore(version): Updated version and changelog.' # This is the default.
remote: 'main' # This is the default.
Setting up Github Releases #
To enable Github releases, go to https://github.com/settings/personal-access-tokens/new to create a new fine-grained personal access token.
- Token name: Choose any name you like.
- Description: Optional.
- Expiration date: Set as preferred.
In the Repository access section, select Only select repositories, then choose your app's repository.
In the Permissions section :
- Click Add permissions.
- Under Contents :
- Set Contents to Read and write.
- Set Metadata to Read-only.
Here is a
screenshot of my setup for the release
utility.
Once done, click Generate token. Then create a .env file at the root of your project folder and add your Github token :
GITHUB_PAT=github_pat_...
Caution
This token should never be shared. Be sure to exclude the .env
file from version control (
e.g., by adding it to your .gitignore
).
Example #
This utility is already in use in some of my apps and projects. Feel free to check out their CHANGELOG.md, pubspec.yaml, and release pages :
License #
This project is licensed under the MIT License.
Contributions #
There are many ways to contribute to this project :
- Fork it on Github.
- Submit an issue for a feature request or bug report.
- Donate to support the developer.