|
| 1 | +env: |
| 2 | + PHP_VERSION: "8.4.12" |
| 3 | + |
| 4 | +name: "Server" |
| 5 | +on: |
| 6 | + release: |
| 7 | + types: [created] |
| 8 | + |
| 9 | +jobs: |
| 10 | + server-build: |
| 11 | + if: github.actor == 'solcloud' |
| 12 | + permissions: |
| 13 | + contents: write |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + persist-credentials: false |
| 19 | + |
| 20 | + - name: "Install Linux dependencies" |
| 21 | + timeout-minutes: 4 |
| 22 | + run: | |
| 23 | + sudo apt-get update && sudo apt-get install -y \ |
| 24 | + composer zip tar curl |
| 25 | +
|
| 26 | + - name: "Install Composer dependencies" |
| 27 | + timeout-minutes: 6 |
| 28 | + run: | |
| 29 | + composer install -a --no-dev |
| 30 | +
|
| 31 | + - name: "Pack into phar" |
| 32 | + timeout-minutes: 4 |
| 33 | + run: | |
| 34 | + curl -Lo box.phar "https://github.com/box-project/box/releases/latest/download/box.phar" |
| 35 | + ln -s cli/server.php index.php |
| 36 | + php box.phar compile |
| 37 | +
|
| 38 | + - name: "Pack into static executable" |
| 39 | + timeout-minutes: 6 |
| 40 | + run: | |
| 41 | + echo "Packing for linux" |
| 42 | + curl -Lo linux.tar.gz "https://dl.static-php.dev/static-php-cli/common/php-${PHP_VERSION}-micro-linux-x86_64.tar.gz" |
| 43 | + tar xf linux.tar.gz |
| 44 | + cat micro.sfx index.phar > server-linux-x86_64 |
| 45 | + rm micro.sfx |
| 46 | + echo "Packing for mac" |
| 47 | + curl -Lo mac.tar.gz "https://dl.static-php.dev/static-php-cli/common/php-${PHP_VERSION}-micro-macos-x86_64.tar.gz" |
| 48 | + tar xf mac.tar.gz |
| 49 | + cat micro.sfx index.phar > server-mac-x86_64 |
| 50 | + rm micro.sfx |
| 51 | + echo "Packing for windows" |
| 52 | + curl -Lo windows.zip "https://dl.static-php.dev/static-php-cli/windows/spc-max/php-${PHP_VERSION}-micro-win.zip" |
| 53 | + unzip windows.zip |
| 54 | + cat micro.sfx index.phar > server-windows-x86_64 |
| 55 | + rm micro.sfx |
| 56 | +
|
| 57 | + - name: "Publish Linux server executable" |
| 58 | + timeout-minutes: 6 |
| 59 | + env: |
| 60 | + RELEASE_ID: ${{ github.event.release.id }} |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + run: | |
| 63 | + curl -L \ |
| 64 | + -X POST \ |
| 65 | + -H "Accept: application/vnd.github+json" \ |
| 66 | + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ |
| 67 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 68 | + -H "Content-Type: application/octet-stream" \ |
| 69 | + "https://uploads.github.com/repos/coopryan/csf/releases/${RELEASE_ID}/assets?name=csf-server-linux" \ |
| 70 | + --data-binary "@server-linux-x86_64" |
| 71 | +
|
| 72 | + - name: "Publish macOS server executable" |
| 73 | + timeout-minutes: 6 |
| 74 | + env: |
| 75 | + RELEASE_ID: ${{ github.event.release.id }} |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + run: | |
| 78 | + curl -L \ |
| 79 | + -X POST \ |
| 80 | + -H "Accept: application/vnd.github+json" \ |
| 81 | + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ |
| 82 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 83 | + -H "Content-Type: application/octet-stream" \ |
| 84 | + "https://uploads.github.com/repos/coopryan/csf/releases/${RELEASE_ID}/assets?name=csf-server-mac" \ |
| 85 | + --data-binary "@server-mac-x86_64" |
| 86 | +
|
| 87 | + - name: "Publish Windows server executable" |
| 88 | + timeout-minutes: 6 |
| 89 | + env: |
| 90 | + RELEASE_ID: ${{ github.event.release.id }} |
| 91 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + run: | |
| 93 | + curl -L \ |
| 94 | + -X POST \ |
| 95 | + -H "Accept: application/vnd.github+json" \ |
| 96 | + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ |
| 97 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 98 | + -H "Content-Type: application/octet-stream" \ |
| 99 | + "https://uploads.github.com/repos/coopryan/csf/releases/${RELEASE_ID}/assets?name=csf-server-windows.bat" \ |
| 100 | + --data-binary "@server-windows-x86_64" |
0 commit comments