Skip to content

ci: install splitsh via 'go install' (no prebuilt binary in v2) #4

ci: install splitsh via 'go install' (no prebuilt binary in v2)

ci: install splitsh via 'go install' (no prebuilt binary in v2) #4

Workflow file for this run

name: Split PHP package to auto-html-i18n-php
# Mirrors packages/php/ to the auto-html-i18n-php repo using splitsh/lite — preserves
# git history so the split repo looks like a real package, not a flat dump.
# Push to main → main (latest source). Tag push or workflow_dispatch with tag → tag (frozen version).
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: 'Tag to mirror (leave blank to mirror main only)'
required: false
type: string
jobs:
split:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history needed for splitsh
- uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.PHP_SPLIT_DEPLOY_KEY }}
- name: Trust github.com SSH host key
run: |
mkdir -p ~/.ssh && chmod 700 ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null
- name: Install splitsh-lite
run: |
go install github.com/splitsh/lite@v2.0.0
echo "$HOME/go/bin" >> "$GITHUB_PATH"
- name: Determine ref to mirror
id: ref
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ inputs.tag }}" ]]; then
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
echo "checkout=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
echo "checkout=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
else
echo "tag=" >> "$GITHUB_OUTPUT"
echo "checkout=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Checkout target ref
run: git checkout "${{ steps.ref.outputs.checkout }}"
- name: Split packages/php and push
env:
TAG: ${{ steps.ref.outputs.tag }}
run: |
set -euo pipefail
git remote add split git@github.com:gabepri/auto-html-i18n-php.git
SHA=$(lite --prefix=packages/php)
echo "Split SHA: $SHA"
if [ -z "$TAG" ]; then
echo "Mirroring main → main"
git push split "$SHA:refs/heads/main"
else
echo "Mirroring $TAG → tag $TAG"
git push split --force "$SHA:refs/tags/$TAG"
fi