private async function updateHHVMVersionAsync()

in src/build/UpdateTagsCLI.hack [150:195]


  private async function updateHHVMVersionAsync(
    string $hhvm_tag,
  ): Awaitable<void> {
    $new_major_minor = $hhvm_tag
      |> Str\strip_prefix($$, 'HHVM-')
      |> Str\split($$, '.')
      |> Vec\take($$, 2)
      |> Str\join($$, '.');
    $old_major_minor = PRODUCT_TAGS[APIProduct::HACK]
      |> Str\strip_prefix($$, 'HHVM-')
      |> Str\split($$, '.')
      |> Vec\take($$, 2)
      |> Str\join($$, '.');
    $stdout = $this->getTerminal()->getStdout();

    await $stdout->writeAllAsync(" - updating composer.json\n");
    $this->updateComposerJson($new_major_minor);

    await $stdout->writeAllAsync(" - updating Dockerfiles\n");
    $dockerfiles = \glob(LocalConfig::ROOT.'/.deploy/*.Dockerfile');
    $dockerfiles[] = LocalConfig::ROOT.'/.devcontainer/Dockerfile';

    foreach ($dockerfiles as $path) {
      \file_get_contents($path)
        |> Str\replace(
          $$,
          'hhvm-proxygen:'.$old_major_minor.'-latest',
          'hhvm-proxygen:'.$new_major_minor.'-latest',
        )
        |> Str\replace(
          $$,
          'hhvm:'.$old_major_minor.'-latest',
          'hhvm:'.$new_major_minor.'-latest',
        )
        |> \file_put_contents($path, $$);
    }
    await $stdout->writeAllAsync(" - updating GitHub Actions\n");
    $path = LocalConfig::ROOT.'/.github/workflows/build-and-test.yml';
    \file_get_contents($path)
      |> Str\replace(
        $$,
        "hhvm: [ '".$old_major_minor."' ]",
        "hhvm: [ '".$new_major_minor."' ]",
      )
      |> \file_put_contents($path, $$);
  }