Attach an asset to a github release
You can use pub_release to automatically attach an asset to a git 'release'.
Install dcli which we will use to create the hook.
1
pub global activate dcli
2
dcli install
Copied!
You will need to obtain a github personal access token:
Copy the following script to:
<project root>/tool/post_release_hook\publish_asset.dart
1
#! /usr/bin/env dcli
2
​
3
import 'package:dcli/dcli.dart';
4
import 'package:settings_yaml/settings_yaml.dart';
5
​
6
void main(List<String> args) {
7
var project = DartProject.current;
8
​
9
var pathToSettings = join(project.pathToProjectRoot, 'tool', 'post_release_hook', 'settings.yaml');
10
var settings = SettingsYaml.load(pathToSettings: pathToSettings);
11
var username = settings['username'] as String;
12
var apiToken = settings['apiToken'] as String;
13
var owner = settings['owner'] as String;
14
var repository = settings['repository'] as String;
15
​
16
'github_release -u $username --apiToken $apiToken --owner $owner --repository $repository'
17
.start(workingDirectory: Script.current.pathToProjectRoot);
18
}
Copied!

​

Last modified 6mo ago
Copy link
Contents