name: Release # Tag a version (e.g. `git tag v1.1.0 && git push --tags`) to build the plugin # ZIP and publish it to the license backend, which then serves it to licensed # sites as an update. on: push: tags: - 'v*' jobs: build-and-publish: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Derive version from tag id: v run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - name: Stamp version into the plugin header env: V: ${{ steps.v.outputs.version }} run: | sed -i "s/^ \* Version:.*/ * Version: ${V}/" gdpr-content-blocker.php sed -i "s/define( 'CB_VERSION', *'[^']*' )/define( 'CB_VERSION', '${V}' )/" gdpr-content-blocker.php - name: Build ZIP (top-level gdpr-content-blocker/ folder) run: | mkdir -p build/gdpr-content-blocker rsync -a \ --exclude '.git' --exclude '.gitea' --exclude 'build' \ --exclude 'node_modules' --exclude '*.zip' \ ./ build/gdpr-content-blocker/ (cd build && zip -r ../gdpr-content-blocker.zip gdpr-content-blocker) - name: Publish to license backend env: BACKEND: ${{ secrets.LICENSE_BACKEND_URL }} TOKEN: ${{ secrets.LICENSE_ADMIN_TOKEN }} V: ${{ steps.v.outputs.version }} run: | curl -fSs -X POST \ "${BACKEND}/api/v1/releases?product=gdpr-content-blocker&version=${V}" \ -H "X-Admin-Token: ${TOKEN}" \ -H "Content-Type: application/zip" \ -H "X-Tested: 6.7" \ -H "X-Requires-PHP: 8.1" \ --data-binary @gdpr-content-blocker.zip