addGithubTasks function

void addGithubTasks()

Enables tasks for releasing the package on GitHub releases.

Implementation

void addGithubTasks() {
  if (_addedGithubTasks) return;
  _addedGithubTasks = true;

  freezeSharedVariables();
  githubRepo.freeze();
  githubUser.freeze();
  githubPassword.freeze();
  githubBearerToken.freeze();
  githubReleaseNotes.freeze();

  addStandaloneTasks();

  addTask(GrinderTask('pkg-github-release',
      taskFunction: _release,
      description: 'Create a GitHub release, without executables.'));

  for (var platform in CliPlatform.all) {
    addTask(GrinderTask('pkg-github-$platform',
        taskFunction: () => _uploadExecutables(platform),
        description:
            'Release executable to GitHub for ${platform.toHumanString()}.',
        depends: ['pkg-standalone-$platform']));
  }

  var osTasks = [
    for (var MapEntry(key: os, value: platforms)
        in CliPlatform.all.groupListsBy((platform) => platform.os).entries)
      GrinderTask('pkg-github-$os',
          description: 'Release ${platforms.first.os.toHumanString()} '
              'executables to GitHub.',
          depends: platforms.map((platform) => 'pkg-github-$platform'))
  ]..forEach(addTask);

  var dependencies = ['pkg-github-release'];
  dependencies.addAll(osTasks.map((task) => task.name));

  addTask(GrinderTask('pkg-github-all',
      description: 'Create a GitHub release with all executables.',
      depends: dependencies));

  addTask(GrinderTask('pkg-github-fix-permissions',
      description: 'Fix insecure permissions for older GitHub releases.\n'
          'See https://sass-lang.com/blog/security-alert-tar-permissions',
      taskFunction: _fixPermissions));
}