v1.6.3 #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: 📦 Build binary | |
| on: # yamllint disable-line rule:truthy | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| build-unix: | |
| runs-on: ubuntu-latest | |
| name: 📦 Build Unix Executables | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - os: linux | |
| arch: amd64 | |
| - os: linux | |
| arch: arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| with: | |
| platforms: arm64,amd64 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Extract version from tag | |
| id: get_version | |
| run: | | |
| if [[ "$GITHUB_REF_NAME" == refs/pull/* ]]; then | |
| # For pull requests, use "dev" as version | |
| VERSION="dev" | |
| else | |
| # For releases, extract version from tag (remove 'v' prefix if present) | |
| VERSION=${GITHUB_REF_NAME#v} | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "{\"version\": \"$VERSION\", \"type\":\"bin\"}" > version.json | |
| - name: Build Docker image for ${{ matrix.platform.os }}-${{ matrix.platform.arch }} | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| tags: dload-builder-${{ matrix.platform.os }}-${{ matrix.platform.arch }}:latest | |
| platforms: linux/${{ matrix.platform.arch }} | |
| build-args: | | |
| TARGET_OS=${{ matrix.platform.os }} | |
| TARGET_ARCH=${{ matrix.platform.arch }} | |
| VERSION=${{ env.VERSION }} | |
| cache-from: type=gha,scope=${{ matrix.platform.os }}-${{ matrix.platform.arch }} | |
| cache-to: type=gha,mode=max,scope=${{ matrix.platform.os }}-${{ matrix.platform.arch }} | |
| - name: Extract executable | |
| run: | | |
| mkdir -p dist | |
| container_id=$(docker create dload-builder-${{ matrix.platform.os }}-${{ matrix.platform.arch }}:latest) | |
| docker cp $container_id:/.output/dload ./dist/dload | |
| docker rm $container_id | |
| - name: Zip output | |
| uses: ksm2/archive-action@v1 | |
| with: | |
| root-directory: dist | |
| format: "tar.gz" | |
| name: dload-${{ env.VERSION }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }} | |
| - name: 📤 Upload release assets | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| token: "${{ secrets.RELEASE_TOKEN }}" | |
| files: | | |
| ./dload-${{ env.VERSION }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz | |
| build-macos-arm64: | |
| runs-on: macos-14 | |
| name: 📦 Build macOS ARM64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.4' | |
| extensions: mbstring, xml, sockets, curl | |
| coverage: none | |
| - name: Extract version from tag or set dev version | |
| id: get_version | |
| shell: bash | |
| run: | | |
| if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" && -n "${{ github.event.inputs.version }}" ]]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| elif [[ "$GITHUB_REF" == refs/pull/* || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then | |
| # For pull requests or manual triggers without version, use "dev" as version | |
| VERSION="dev" | |
| else | |
| # For releases, extract version from tag (remove 'v' prefix if present) | |
| VERSION=${GITHUB_REF_NAME#v} | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "{\"version\": \"$VERSION\", \"type\":\"bin\"}" > version.json | |
| - name: Install Composer dependencies | |
| run: composer install --no-dev --prefer-dist --ignore-platform-reqs | |
| - name: Create build directories | |
| run: mkdir -p .build/phar .build/bin dist | |
| - name: Download box tool | |
| run: | | |
| curl -fsSL -o .build/bin/box.phar https://github.com/box-project/box/releases/download/4.6.6/box.phar | |
| chmod +x .build/bin/box.phar | |
| - name: Download SPC for macOS ARM64 | |
| run: | | |
| curl -fsSL -o .build/bin/spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64 | |
| chmod +x .build/bin/spc | |
| - name: Download required PHP extensions | |
| run: | | |
| export SPC_SKIP_BREW_INSTALL=1 | |
| .build/bin/spc download micro --for-extensions=ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,curl,tokenizer,xml,xmlwriter --with-php=8.4 --prefer-pre-built | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
| - name: Verify environment is ready | |
| run: | | |
| export SPC_SKIP_BREW_INSTALL=1 | |
| .build/bin/spc doctor --auto-fix | |
| - name: Build PHAR file | |
| run: | | |
| php .build/bin/box.phar compile -v | |
| - name: Build the self-executable binary | |
| run: | | |
| # Skip Homebrew installation (we don't need it) | |
| export SPC_SKIP_BREW_INSTALL=1 | |
| .build/bin/spc build "ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,curl,tokenizer,xml,xmlwriter" --build-micro | |
| - name: Combine micro.sfx with the PHAR | |
| run: | | |
| .build/bin/spc micro:combine .build/phar/dload.phar --output=dist/dload | |
| - name: Test binary | |
| run: | | |
| chmod +x dist/dload | |
| dist/dload --help | |
| - name: Zip output | |
| uses: ksm2/archive-action@v1 | |
| with: | |
| root-directory: dist | |
| format: "tar.gz" | |
| name: dload-${{ env.VERSION }}-darwin-arm64 | |
| - name: 📤 Upload release assets | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| token: "${{ secrets.RELEASE_TOKEN }}" | |
| files: | | |
| ./dload-${{ env.VERSION }}-darwin-arm64.tar.gz | |
| build-macos-amd64: | |
| runs-on: macos-latest | |
| name: 📦 Build macOS (x64) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.4' | |
| extensions: mbstring, xml, sockets, curl | |
| coverage: none | |
| - name: Extract version from tag or set dev version | |
| id: get_version | |
| shell: bash | |
| run: | | |
| if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" && -n "${{ github.event.inputs.version }}" ]]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| elif [[ "$GITHUB_REF" == refs/pull/* || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then | |
| # For pull requests or manual triggers without version, use "dev" as version | |
| VERSION="dev" | |
| else | |
| # For releases, extract version from tag (remove 'v' prefix if present) | |
| VERSION=${GITHUB_REF_NAME#v} | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "{\"version\": \"$VERSION\", \"type\":\"bin\"}" > version.json | |
| - name: Install Composer dependencies | |
| run: composer install --no-dev --prefer-dist --ignore-platform-reqs | |
| - name: Create build directories | |
| run: mkdir -p .build/phar .build/bin dist | |
| - name: Download SPC for macOS AMD64 | |
| run: | | |
| curl -fsSL -o .build/bin/spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64 | |
| chmod +x .build/bin/spc | |
| - name: Download box tool | |
| run: | | |
| curl -fsSL -o .build/bin/box.phar https://github.com/box-project/box/releases/download/4.6.6/box.phar | |
| chmod +x .build/bin/box.phar | |
| - name: Install Intel Homebrew for AMD64 | |
| run: | | |
| # Check if we need to install Intel Homebrew | |
| if [[ ! -d "/usr/local/Homebrew" ]]; then | |
| echo "Installing Intel (x86_64) version of Homebrew" | |
| arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| fi | |
| - name: Download required PHP extensions | |
| run: | | |
| # For AMD64, ensure we're using the Intel Homebrew | |
| export PATH="/usr/local/bin:$PATH" | |
| .build/bin/spc download micro --for-extensions=ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,curl,tokenizer,xml,xmlwriter --with-php=8.4 --prefer-pre-built | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
| - name: Verify environment is ready | |
| run: | | |
| export PATH="/usr/local/bin:$PATH" | |
| .build/bin/spc doctor --auto-fix | |
| - name: Build PHAR file | |
| run: | | |
| php .build/bin/box.phar compile -v | |
| - name: Build the self-executable binary | |
| run: | | |
| export PATH="/usr/local/bin:$PATH" | |
| .build/bin/spc build "ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,curl,tokenizer,xml,xmlwriter" --build-micro | |
| - name: Combine micro.sfx with the PHAR | |
| run: | | |
| export PATH="/usr/local/bin:$PATH" | |
| .build/bin/spc micro:combine .build/phar/dload.phar --output=dist/dload | |
| - name: Test binary | |
| run: | | |
| chmod +x dist/dload | |
| dist/dload --help | |
| - name: Zip output | |
| uses: ksm2/archive-action@v1 | |
| with: | |
| root-directory: dist | |
| format: "tar.gz" | |
| name: dload-${{ env.VERSION }}-darwin-amd64 | |
| - name: 📤 Upload release assets | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| token: "${{ secrets.RELEASE_TOKEN }}" | |
| files: | | |
| ./dload-${{ env.VERSION }}-darwin-amd64.tar.gz | |
| build-windows: | |
| runs-on: windows-latest | |
| name: 📦 Build Windows (x64) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.4' | |
| extensions: mbstring, xml, sockets, curl | |
| coverage: none | |
| - name: Extract version from tag or set dev version | |
| id: get_version | |
| shell: bash | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/pull/* ]]; then | |
| # For pull requests, use "dev" as version | |
| VERSION="dev" | |
| else | |
| # For releases, extract version from tag (remove 'v' prefix if present) | |
| VERSION=${GITHUB_REF_NAME#v} | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "{\"version\": \"$VERSION\", \"type\":\"bin\"}" > version.json | |
| - name: Install Composer dependencies | |
| run: composer install --no-dev --prefer-dist --ignore-platform-reqs | |
| - name: Create build directories | |
| run: New-Item -Path ".build\phar", ".build\bin" -ItemType Directory -Force | |
| - name: Download box tool | |
| run: | | |
| Invoke-WebRequest -Uri "https://github.com/box-project/box/releases/download/4.6.6/box.phar" -OutFile ".build/bin/box.phar" | |
| - name: Download SPC for Windows | |
| run: | | |
| Invoke-WebRequest -Uri "https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe" -OutFile ".build/bin/spc.exe" | |
| - name: Download required PHP extensions | |
| run: .build/bin/spc.exe download micro --for-extensions=ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,curl,tokenizer,xml,xmlwriter --with-php=8.4 --prefer-pre-built | |
| # todo: fix this | |
| # - name: Install UPX for compression | |
| # run: | | |
| # .build/bin/spc.exe install-pkg upx | |
| - name: Verify environment is ready | |
| run: | | |
| .build/bin/spc.exe doctor --auto-fix | |
| - name: Build the self-executable binary | |
| run: .build/bin/spc.exe build "ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,curl,tokenizer,xml,xmlwriter" --build-micro # --with-upx-pack | |
| - name: Build PHAR file | |
| run: | | |
| php .build/bin/box.phar compile -v --allow-composer-check-failure | |
| - name: Combine micro.sfx with the PHAR | |
| run: | | |
| New-Item -Path "dist" -ItemType Directory -Force | |
| .build\bin\spc.exe micro:combine .build\phar\dload.phar --output=dist\dload.exe | |
| - name: Zip output | |
| uses: ksm2/archive-action@v1 | |
| with: | |
| root-directory: dist | |
| format: "tar.gz" | |
| name: dload-${{ env.VERSION }}-windows-amd64 | |
| - name: 📤 Upload release assets | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| token: "${{ secrets.RELEASE_TOKEN }}" | |
| files: | | |
| ./dload-${{ env.VERSION }}-windows-amd64.tar.gz |