release_updater
A simple way to automatically update release/installation files in a local directory.
A simple way to update release/installation files in a local directory.
^1.2.3^1.0.6^2.3.0^1.4.2^1.1.3^4.1.0^0.8.19^2.3.3^3.0.7^1.9.1^2.2.1^1.0.1^4.2.0^1.19.1^3.1.4^5.1.1^1.32.0^5.0.6^1.15.1^2.3.0English project snapshot. Visit GitHub for the latest content.
pub package Null Safety Codecov Dart CI GitHub Tag New Commits Last Commits Pull Requests Code size License
This package brings a simple way to automatically update release/installation files in a local directory.
It also comes with built-in CLI tools to easily generate a release bundle (Zip file) or serve release files for multiple platforms.
Since Dart can run in many native platforms (Linux/x64, macOS/x64/arm64, Windows/x86),
it's not simple to manage all the different releases+platforms files that a
compiled Dart application can have.
In the same way that modern Browsers, and many other applications, can have automatic builds and updates for multiple platforms, this package provides tools and an API to easily achieve that.
See the API Documentation for a full list of functions, classes and extension.
import 'dart:io';
import 'package:release_updater/release_updater_io.dart';
void main() async {
var storage = ReleaseStorageDirectory('appx', Directory('/install/path'));
var provider = ReleaseProviderHttp.baseURL('https://your.domain/appx/releases');
var releaseUpdater = ReleaseUpdater(storage, provider);
var version = await releaseUpdater.update();
print('» Updated to version: $version');
var runResult = await releaseUpdater.runReleaseProcess('run.exe', ['-a']);
var exitCode = runResult!.exitCode;
print('» Exit code: $exitCode');
print('» Result: ${runResult.stdout}');
exit(exitCode);
}
You can implement your own ReleaseProvider or use just the built-in ReleaseProviderHttp class.
release_updater: A CLI updater.
release_updater_server: A simple HTTP server to provide releases using the shelf package.
The release_updater is a CLI for the ReleaseUpdater class.
To build a release:
$> release_packer release_packer.json build ./source-dir ./releases-dir -Pupload-url=http://your-server:8090/ -Pupload-user=userx -Pupload-pass=pass123
-P arguments are properties to the JSON configuration file (see %UPLOAD_URL% below).Example of a release_packer.json file:
{
"name": "appx",
"version_from": "pubspec.yaml",
"prepare": [
"dart_pub_get",
{"dart_compile_exe": "bin/foo.dart"},
{"windows_gui": "bin/foo.exe"}
],
"finalize": [
{"rm": "bin/foo.exe"},
{
"upload_release": {
"url": "%UPLOAD_URL%",
"authorization": {
"user": "%UPLOAD_USER%",
"pass": "%UPLOAD_PASS%"
}
}
}
],
"files": [
"README.md",
{"hello.txt": "hello-world.txt"},
{"bin/foo.exe": "."},
{"libfoo-arm64.dylib": ".", "platform": "^macos-arm64$"},
{"libfoo-x64.dylib": ".", "platform": "^macos-x64$"},
{"libfoo.so": ".", "platform": "^linux.*$"},
{"libfoo.dll": ".", "platform": "^windows.*$"}
]
}
name: the application name, for the Release name.
version: the version of the Release.
version_from: the JSON or YAML file to provide the field version (if the parameter field is not provided).
platform: is a RegExp string to match the building platform. See the ReleasePlatform class.
Command types:
dart_pub_get: performs a dart pub get.dart_compile_exe: performs a dart compile exe %dart_script.dart: performs a dart %command.windows_gui: Changes an executable Windows Subsistem to GUI.command: performs a shell %command.rm: Deletes a file.upload_release: uploads the generated release.
url: release server base URL.authorization: HTTP basic authorization.
username: authentication username.password: authentication password.Command errors:
release_packer CLI
exits with code 1. This avoids a silent error generating and
releasing an incomplete package/artifact.rm of a file that doesn't exist.windows_gui over a file that is not a Windows executable (the usual
case when building on another platform).files: each entry of files can be:
String with a file path:"file/path.txt"
Map with extra parameters:
{"source/file/path.txt": "release/file/path", "platform": "^regexp"}
{"source/file/path.txt": "."}
{"lib/resources/": "packages/pack_name/resources/"}
dart_compile_exe command:{"bin/client.exe": "client.exe", "dart_compile_exe": "bin/client.dart"}
GUI:{"bin/client.exe": "client.exe", "windows_gui": true}
To serve a release directory:
$> release_updater_server releases-server-config.json
Config file:
{
"releases-directory": "/path/to/releases",
"port": 8090,
"address": "0.0.0.0",
"upload-user": "userx",
"upload-pass": "123456"
}
upload-user and upload-pass (with length >= 6) are defined,
upload of files will be allowed.
releases-directory without
any sub-directory.IP for 30min.IP for 2min.The official source code is hosted @ GitHub:
Please file feature requests and bugs at the issue tracker.
Any help from the open-source community is always welcome and needed:
If you donate 1 hour of your time, you can contribute a lot, because others will do the same, just be part and start with your 1 hour.
Graciliano M. Passos: gmpassos@GitHub.