Skip to content

Instantly share code, notes, and snippets.

@KygekDev
Last active December 2, 2021 07:36
Show Gist options
  • Select an option

  • Save KygekDev/03ed5fe1af07ade557770845728e7724 to your computer and use it in GitHub Desktop.

Select an option

Save KygekDev/03ed5fe1af07ade557770845728e7724 to your computer and use it in GitHub Desktop.

Revisions

  1. KygekDev revised this gist Dec 2, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion azure.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ Make a new file named `azure.php` and copy the PHP code below to the file:
    ```php
    <?php

    const BUILDS_REST_API = "https://dev.azure.com/pocketmine/PHP-Builds/_apis/build/builds?api-version=6.0&branchName=refs/heads/master";
    const BUILDS_REST_API = "https://dev.azure.com/pocketmine/PHP-Builds/_apis/build/builds?api-version=6.0&branchName=refs/heads/stable";

    if (count($argv) < 2) {
    echo "Operating system argument is required!";
  2. KygekDev created this gist Sep 25, 2021.
    46 changes: 46 additions & 0 deletions azure.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    ## Get the latest PocketMine-MP 4 PHP binary URL from Azure DevOps

    ### Prerequisites
    You need PHP installed with HTTPS `file_get_contents()` feature enabled in `php.ini`.

    ### Code
    Make a new file named `azure.php` and copy the PHP code below to the file:

    ```php
    <?php

    const BUILDS_REST_API = "https://dev.azure.com/pocketmine/PHP-Builds/_apis/build/builds?api-version=6.0&branchName=refs/heads/master";

    if (count($argv) < 2) {
    echo "Operating system argument is required!";
    exit(1);
    } elseif (!in_array($argv[1], ["Windows", "Linux", "Mac"])) {
    echo "Unknown operating system!";
    exit(1);
    }

    $runs = json_decode(file_get_contents(BUILDS_REST_API), true);
    $buildId = $runs["value"]["0"]["id"];

    echo "https://dev.azure.com/pocketmine/a29511ba-1771-4ad2-a606-23c00a4b8b92/_apis/build/builds/" . $buildId . "/artifacts?artifactName=" . $argv[1] . "&api-version=4.1&%24format=zip";
    ```

    ### Running
    Run the following commands to get the URL of the latest PocketMine-MP 4 PHP binary (Case sensitive!):

    Windows:
    ```sh
    $ php azure.php Windows
    ```

    Linux:
    ```sh
    $ php azure.php Linux
    ```

    Mac OS:
    ```sh
    $ php azure.php Mac
    ```

    It will print the URL in your terminal, or to a file or program if you use shell commands to process the output.