4ce4204b6c
CI / Lint (push) Failing after 2s
CI / Build (push) Has been skipped
SDK CI / PHP SDK (push) Failing after 1s
Split PHP SDK / PHP SDK tests (push) Failing after 1s
CI / Test (push) Failing after 1s
CI / Dashboard (push) Failing after 0s
SDK CI / JavaScript SDK (push) Failing after 0s
SDK CI / Python SDK (push) Failing after 2s
SDK CI / Java SDK (push) Failing after 1s
Split PHP SDK / Mirror sdk/php -> rmyndharis/openwa-php (push) Has been skipped
CI / Test (PostgreSQL migrations) (push) Failing after 7m47s
CI / Docker Build (push) Has been skipped
74 lines
2.5 KiB
YAML
74 lines
2.5 KiB
YAML
name: Split PHP SDK
|
|
|
|
# Mirrors the PHP SDK (sdk/php) into the standalone repo rmyndharis/openwa-php,
|
|
# which is what Packagist installs (Packagist needs composer.json at a repo root
|
|
# and does not support subdirectories). Uses a dependency-free `git subtree
|
|
# split` + force-push — no third-party action.
|
|
#
|
|
# IMPORTANT: this only syncs the `main` branch (-> Packagist `dev-main`). The
|
|
# monorepo's `v*` tags are the APP version, NOT the SDK version, so they are
|
|
# deliberately NOT propagated. To cut a versioned SDK release, tag the mirror
|
|
# repo directly (see sdk/php — RELEASING below), e.g. `git tag 0.1.0`.
|
|
#
|
|
# One-time setup:
|
|
# 1. Create an empty GitHub repo: rmyndharis/openwa-php
|
|
# 2. Create a PAT (fine-grained, repo = openwa-php, Contents: read & write)
|
|
# 3. Add it to THIS repo as the secret PHP_SDK_SPLIT_TOKEN
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ['sdk/php/**']
|
|
workflow_dispatch: {}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: split-php-sdk
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
test:
|
|
name: PHP SDK tests
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: sdk/php
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.2'
|
|
- run: composer install --no-interaction --no-progress
|
|
- run: ./vendor/bin/phpunit
|
|
|
|
split:
|
|
name: Mirror sdk/php -> rmyndharis/openwa-php
|
|
# Never mirror an untested (red) SDK to Packagist dev-main.
|
|
needs: [test]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0 # full history is required for `git subtree split`
|
|
persist-credentials: false # stop the GITHUB_TOKEN extraheader from shadowing the PAT in the push URL
|
|
|
|
- name: Split and force-push to the mirror repo
|
|
env:
|
|
SPLIT_TOKEN: ${{ secrets.PHP_SDK_SPLIT_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -z "${SPLIT_TOKEN:-}" ]; then
|
|
echo "::notice::PHP_SDK_SPLIT_TOKEN is not set — skipping. Create rmyndharis/openwa-php and add the secret to enable the mirror."
|
|
exit 0
|
|
fi
|
|
git config user.name "rmyndharis"
|
|
git config user.email "yudhi@rmyndharis.com"
|
|
SPLIT_SHA="$(git subtree split --prefix=sdk/php HEAD)"
|
|
echo "Split SHA: $SPLIT_SHA"
|
|
git push --force \
|
|
"https://x-access-token:${SPLIT_TOKEN}@github.com/rmyndharis/openwa-php.git" \
|
|
"${SPLIT_SHA}:refs/heads/main"
|
|
echo "Mirrored sdk/php -> rmyndharis/openwa-php@main"
|