actions/checkout and actions/setup-node v4 -> v5, softprops/action-gh-release v2 -> v3; all three run on Node 24. setup-deno@v2, setup-bun@v2 and crates-io-auth-action@v1 already resolve to Node 24 releases. Jobs keep node-version 22. Refs Green-Tea/core#103 Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
52 lines
2.4 KiB
YAML
52 lines
2.4 KiB
YAML
name: Promote → GitHub
|
|
|
|
# Promotion. Runs on GITEA ONLY. Mirrors two branches to the public GitHub repo and nothing else:
|
|
#
|
|
# main → GitHub main what has been promoted
|
|
# develop → GitHub contrib what outside contributors fork from and target
|
|
#
|
|
# Feature branches stay private, which is why this is a workflow rather than a push-mirror — that
|
|
# would expose every branch.
|
|
#
|
|
# `contrib` exists because CONTRIBUTING.md sends people there. A pull request against `main` would
|
|
# put the two forges out of step, so contributors need a branch that tracks current development,
|
|
# and this is it. Same arrangement as core.
|
|
#
|
|
# Neither push is forced. For `contrib` that is the guard rather than a limitation: the push is
|
|
# refused exactly when `contrib` holds external merges nobody has carried into `develop` yet. Carry
|
|
# them, and the next develop push fast-forwards.
|
|
#
|
|
# Tags are deliberately NOT mirrored, and `--tags` is left off the push for the same reason. These
|
|
# packages publish to JSR, where a version can never be replaced or removed — so promoting a tag
|
|
# has to stay a decision someone takes deliberately, never a side effect of promoting a branch.
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
|
|
jobs:
|
|
push-github:
|
|
if: ${{ github.server_url != 'https://github.com' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0 # full history for a clean push
|
|
- name: Push to GitHub
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GH_PROMOTE_TOKEN }}
|
|
run: |
|
|
case "$GITHUB_REF_NAME" in
|
|
main) target=main ;;
|
|
develop) target=contrib ;;
|
|
*) echo "::error::promote runs for main and develop only, got '$GITHUB_REF_NAME'"; exit 1 ;;
|
|
esac
|
|
if [ -z "$GH_TOKEN" ]; then
|
|
echo "::error::GH_PROMOTE_TOKEN is not set on this repository. Add it in Settings → Actions → Secrets."
|
|
exit 1
|
|
fi
|
|
git remote add github "https://x-access-token:${GH_TOKEN}@github.com/Expressive-Tea/green-tea-plugins.git"
|
|
if ! git push github "HEAD:refs/heads/${target}"; then
|
|
echo "::error::GitHub ${target} has commits that ${GITHUB_REF_NAME} does not. For contrib that means external merges not yet carried into develop — carry them (CONTRIBUTING.md); never force this push."
|
|
exit 1
|
|
fi
|