name: Release on: push: tags: - 'v*' jobs: test-gate: name: Test Gate (lint + phpcs + phpstan + unit + integration) runs-on: ubuntu-latest # Host-mode runner: no service containers. Uses the host MariaDB, same as # the Tests workflow. steps: - uses: actions/checkout@v4 - name: Install dependencies run: composer install --no-interaction --prefer-dist - name: PHP Lint run: | find . -name "*.php" \ ! -path "./vendor/*" \ ! -path "./tests/*" \ -print0 | xargs -0 -n1 php -l echo "PHP syntax OK" - name: PHPCS run: vendor/bin/phpcs --standard=phpcs.xml --report=checkstyle -q . - name: PHPStan run: vendor/bin/phpstan analyse --no-progress --error-format=github - name: Unit Tests run: php vendor/bin/phpunit --configuration phpunit.xml --testdox - name: Integration Tests env: TMDO_TEST_DB_HOST: 127.0.0.1 TMDO_TEST_DB_USER: dbo TMDO_TEST_DB_PASS: ${{ secrets.TMDO_TEST_DB_PASS }} TMDO_TEST_DB_NAME: wp_wpdo_test run: php vendor/bin/phpunit --configuration phpunit-integration.xml --testdox release: needs: [test-gate] runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Build ZIP run: bash scripts/ci-package.sh - name: Create Gitea Release env: GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }} GITEA_URL: ${{ vars.RELEASE_GITEA_URL }} run: | set -euo pipefail VERSION="${{ gitea.ref_name }}" ZIP=$(ls dist/*.zip | head -1) ZIP_NAME=$(basename "$ZIP") MD5=$(md5sum "$ZIP" | awk '{print $1}') # Create the release RELEASE_ID=$(curl -s -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ "${GITEA_URL}/api/v1/repos/${{ gitea.repository }}/releases" \ -d "{ \"tag_name\": \"${VERSION}\", \"name\": \"${VERSION}\", \"body\": \"MD5: \`${MD5}\`\", \"draft\": false, \"prerelease\": false }" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') # Upload ZIP asset curl -s -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/zip" \ "${GITEA_URL}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=${ZIP_NAME}" \ --data-binary "@${ZIP}" echo "Released ${VERSION} — asset: ${ZIP_NAME} (MD5: ${MD5})"