diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc7793d..1be3442 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push jobs: - build: + build-macos: runs-on: macos-latest steps: - name: Checkout @@ -20,17 +20,9 @@ jobs: - name: Build run: | - curl -OL "https://github.com/box-project/box/releases/latest/download/box.phar" - mv box.phar box - - php box compile - mkdir -p ./build - mv index.phar ./build/ - - cd build || exit - curl -OL https://dl.static-php.dev/static-php-cli/common/php-8.3.6-micro-macos-aarch64.tar.gz -C - - tar -xvf php-8.3.6-micro-macos-aarch64.tar.gz - cat ./micro.sfx ./index.phar > ./phpup && chmod 0755 ./phpup + brew tap box-project/box + brew install box + ./build.sh - name: Release uses: softprops/action-gh-release@v2 @@ -38,3 +30,38 @@ jobs: with: files: | build/phpup + + build-linux: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + tools: composer:v2 + + - name: Install PHP deps + uses: ramsey/composer-install@v2 + run: + wget -O phive.phar "https://phar.io/releases/phive.phar" + wget -O phive.phar.asc "https://phar.io/releases/phive.phar.asc" + gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x6AF725270AB81E04D79442549D8A98B29B2D5D79 + gpg --verify phive.phar.asc phive.phar + rm phive.phar.asc + chmod +x phive.phar + mv phive.phar /usr/local/bin/phive + phive install humbug/box + + - name: Build + run: | + ./build.sh + + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + build/phpup diff --git a/README.md b/README.md index 96e885b..e00cc61 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ You don't need to have PHP or anything at all on your system to run it. > [!WARNING] > **Under heavy development** -> Currently, this is an MVP, and only macOS aarch64 is supported. +> Currently, this is an MVP, and only macOS and linux are supported. ## Installation @@ -29,6 +29,13 @@ sudo mv phpup /usr/local/bin/phpup - `phpup rector` – Rector that does not require PHP. 🚧 - `phpup locus` – Installs PHP binary under your project's `vendor/bin/php` based on the requirements in _composer.json_. +## Building +### Build requirements + +* https://github.com/box-project/box +* PHP 8.3 +* Composer + ## Contributing Contributions are very welcome! However, it's recommended to first create an issue describing the idea — let's find the best approach together. @@ -54,7 +61,7 @@ See some ideas in the todo list below. - [ ] Bypass cli SAPI name checks - [ ] static_opcache - [ ] Support parallel run for Rector -- [ ] Support Linux +- [ ] Support Linux 🚧 ## Credits diff --git a/build.sh b/build.sh index 40438d5..8b83d59 100755 --- a/build.sh +++ b/build.sh @@ -6,6 +6,20 @@ mkdir -p ./build mv index.phar ./build/ cd build || exit -curl -O https://dl.static-php.dev/static-php-cli/common/php-8.3.6-micro-macos-aarch64.tar.gz -C - -tar -xvf php-8.3.4-micro-macos-aarch64.tar.gz + +if ! command -v uname &> /dev/null +then + OS="OS" +else + OS=`uname -a|awk '{print $1}'` + arch=`uname -m|awk '{print $1}'` +fi + +case $OS in + "Darwin" ) curl -o php "https://dl.static-php.dev/static-php-cli/common/php-8.3.6-micro-macos-${arch}.tar.gz" -C -;; + "Linux" ) curl -o php "https://dl.static-php.dev/static-php-cli/common/php-8.3.6-micro-linux-${arch}.tar.gz" -C -;; + * ) echo "${OS} is not supported" + exit ;; +esac +tar -xvf php cat ./micro.sfx ./index.phar > ./phpup && chmod 0755 ./phpup