From 225a55d5d9ca43d2abce07917e3e201f0d2f5d2b Mon Sep 17 00:00:00 2001 From: Kent Riboe Date: Fri, 3 Apr 2026 11:42:18 +0300 Subject: [PATCH] Add GitHub Actions workflow to build self-contained release archives (#999) * Add GitHub Actions workflow to build self-contained release archives (#973) Automatically builds a .tar.gz with vendor/ included when a release is published, this saves users from needing to use composer etc. Currently a single file, built for a PHP 8.2 environment. Thanks @knofte --- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..2e10c049 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: Build Release + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + build-release: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + tools: composer + + - name: Install production dependencies + run: composer install --no-dev --prefer-dist --no-interaction --optimize-autoloader + + - name: Create templates_c directory + run: mkdir -p templates_c + + - name: Determine archive name + id: archive + run: | + TAG="${GITHUB_REF_NAME}" + echo "name=postfixadmin-${TAG}-php82" >> $GITHUB_OUTPUT + + - name: Build release archive + run: | + tar czf /tmp/${{ steps.archive.outputs.name }}.tar.gz \ + --exclude='.git' \ + --exclude='.github' \ + --exclude='tests' \ + --exclude='.php-cs-fixer*' \ + --exclude='phpunit.xml' \ + --exclude='psalm.xml' \ + --exclude='composer.phar' \ + --exclude='composer.lock' \ + --exclude='debian' \ + --transform 's,^\./,${{ steps.archive.outputs.name }}/,' \ + . + + - name: Upload release asset + run: gh release upload "${{ github.event.release.tag_name }}" /tmp/${{ steps.archive.outputs.name }}.tar.gz --clobber + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}