Skip to content

chore: release 1.x (#223) #83

chore: release 1.x (#223)

chore: release 1.x (#223) #83

Workflow file for this run

---
# Splits a plugin/bridge subtree into its dedicated repository whenever
# release-please tags a new component release in the monorepo.
#
# Tag format follows the project convention `include-v-in-tag: false`:
# `<component>-X.Y.Z`, no `v` prefix anywhere. Component is everything
# before the last dash; version is everything after. Bridges live under
# `bridge/<name>` (component prefixed with `bridge-`), plugins under
# `plugin/<name>`.
#
# Required secrets:
# - RELEASE_TOKEN: a GitHub token (PAT or fine-grained) with `contents: write`
# access to every target repo. Same secret is reused for release-please.
on: # yamllint disable-line rule:truthy
push:
tags:
- 'assert-[0-9]*'
- 'bench-[0-9]*'
- 'bridge-infection-[0-9]*'
- 'bridge-symfony-console-[0-9]*'
- 'codecov-[0-9]*'
- 'convention-[0-9]*'
- 'data-[0-9]*'
- 'filter-[0-9]*'
- 'inline-[0-9]*'
- 'lifecycle-[0-9]*'
- 'repeat-[0-9]*'
- 'retry-[0-9]*'
- 'test-[0-9]*'
name: 📦 Split publish
# Serialize runs that target the same tag (e.g. tag rewritten by hand)
# instead of letting two parallel runs race into the same target repo.
concurrency:
group: split-publish-${{ github.ref }}
cancel-in-progress: false
jobs:
split:
name: ↪ Subtree push
runs-on: ubuntu-latest
steps:
- name: ⤵ Checkout monorepo (full history)
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: 🧭 Resolve component / directory / version from tag
id: c
run: |
tag="${GITHUB_REF_NAME}"
component="${tag%-*}"
version="${tag##*-}"
if [[ "${component}" == bridge-* ]]; then
directory="bridge/${component#bridge-}"
else
directory="plugin/${component}"
fi
echo "component=${component}" >> "$GITHUB_OUTPUT"
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "directory=${directory}" >> "$GITHUB_OUTPUT"
- name: 🌿 Resolve source branch for the tag
id: branch
# Tag is created on a major-version branch (1.x, 2.x, …). Push the subtree
# into the same branch name on the target repo so major series stay isolated.
run: |
branch=$(git branch --remotes --contains "${GITHUB_REF_NAME}" \
| sed 's|origin/||' \
| grep -v 'HEAD' \
| head -n 1 \
| tr -d ' ')
echo "name=${branch}" >> "$GITHUB_OUTPUT"
- name: 🚀 Push subtree to php-testo/${{ steps.c.outputs.component }}
uses: symplify/monorepo-split-github-action@v2.3.0
with:
tag: ${{ steps.c.outputs.version }}
package_directory: ${{ steps.c.outputs.directory }}
repository_organization: php-testo
repository_name: ${{ steps.c.outputs.component }}
branch: ${{ steps.branch.outputs.name }}
user_name: 'github-actions[bot]'
user_email: '41898282+github-actions[bot]@users.noreply.github.com'
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
...