From aeed04a5ecdbf37feafb46895fef2c80e1ff31af Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Sat, 17 Feb 2024 00:04:02 +0800 Subject: [PATCH] Update release-build.yml --- .github/workflows/release-build.yml | 47 +++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 78b91a4c..d328d1cd 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -17,12 +17,13 @@ jobs: php-version: - "8.1" micro-version: - - "8.1.26" + - "8.1.27" operating-system: - "linux-x86_64" - "macos-x86_64" - "linux-aarch64" - "macos-aarch64" + - "windows-x64" steps: - name: "Checkout" uses: "actions/checkout@v4" @@ -59,25 +60,45 @@ jobs: - name: "Download minimal combination" run: | - curl https://dl.static-php.dev/static-php-cli/minimal/php-${{ matrix.micro-version }}-micro-${{ matrix.operating-system }}.tar.gz -o tmp.tgz - tar -zxvf tmp.tgz - + if [ "${{ matrix.operating-system }}" = "windows-x64" ]; then + curl https://dl.static-php.dev/static-php-cli/windows/spc-min/php-${{ matrix.micro-version }}-micro-win.zip -o tmp.zip + unzip tmp.zip + else + curl https://dl.static-php.dev/static-php-cli/minimal/php-${{ matrix.micro-version }}-micro-${{ matrix.operating-system }}.tar.gz -o tmp.tgz + tar -zxvf tmp.tgz + fi + - name: "Generate Executable" run: | - cat micro.sfx spc.phar > spc - chmod +x spc + if [ "${{ matrix.operating-system }}" = "windows-x64" ]; then + cat micro.sfx spc.phar > spc.exe + else + cat micro.sfx spc.phar > spc + chmod +x spc + fi - name: "Archive Executable" run: | - tar -czf spc-${{ matrix.operating-system }}.tar.gz spc - echo "filename=spc-${{ matrix.operating-system }}.tar.gz" >> $GITHUB_ENV - echo "OS=${{ matrix.operating-system }}" >> $GITHUB_ENV - if [ "${{ matrix.operating-system }}" == "linux-x86_64" ]; then - ./spc dev:extensions + if [ "${{ matrix.operating-system }}" != "windows-x64" ]; then + tar -czf spc-${{ matrix.operating-system }}.tar.gz spc + echo "filename=spc-${{ matrix.operating-system }}.tar.gz" >> $GITHUB_ENV + echo "OS=${{ matrix.operating-system }}" >> $GITHUB_ENV + if [ "${{ matrix.operating-system }}" == "linux-x86_64" ]; then + ./spc dev:extensions + fi + else + echo "filename=spc-${{ matrix.operating-system }}.exe" >> $GITHUB_ENV + echo "OS=${{ matrix.operating-system }}" >> $GITHUB_ENV fi - name: "Copy file" - run: "mkdir dist/ && cp ${{ env.filename }} dist/ && cp spc dist/spc-$OS" + run: | + if [ "${{ matrix.operating-system }}" != "windows-x64" ]; then + mkdir dist/ && cp ${{ env.filename }} dist/ && cp spc dist/spc-$OS + else + mkdir dist/ && cp ${{ env.filename }} dist/ + echo "SUFFIX=.exe" >> $GITHUB_ENV + fi - name: upload binaries to release uses: softprops/action-gh-release@v1 @@ -100,5 +121,5 @@ jobs: - name: "Upload Artifact" uses: actions/upload-artifact@v3 with: - path: spc + path: spc${{ env.SUFFIX }} name: spc-${{ matrix.operating-system }}