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 #103 Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
51 lines
2.3 KiB
YAML
51 lines
2.3 KiB
YAML
name: Promote → GitHub
|
|
|
|
# Promotion. Runs on GITEA ONLY. Mirrors two branches to the public GitHub repo and nothing else:
|
|
#
|
|
# main → GitHub main the production mirror
|
|
# develop → GitHub contrib what outside contributors fork from and target
|
|
#
|
|
# Feature branches stay Gitea-private (this is why we don't use Gitea's push-mirror, which
|
|
# would expose every branch).
|
|
#
|
|
# Neither push is forced. For `contrib` that is the guard, not a limitation: the push is refused
|
|
# exactly when `contrib` holds external merges that have not been carried into `develop` yet
|
|
# (AGENTS.md, "External contributions"). Carry them and the next develop push fast-forwards.
|
|
#
|
|
# Tags are deliberately NOT mirrored. The same `v*` tag means two different things on the two
|
|
# forges: on Gitea it stages to Verdaccio (`stage.yml`), on GitHub it publishes to npm and
|
|
# JSR, and a JSR version can never be replaced or removed. Promoting the tag is therefore a
|
|
# decision a person takes after reading the staging run, not a side effect of creating it:
|
|
#
|
|
# git push gh v<version>
|
|
#
|
|
# `--tags` is left off the branch push for the same reason. It used to ride along here, which
|
|
# meant any tag sitting in the runner's clone could reach production as a side effect of
|
|
# promoting `main` — a publish nobody chose, of a commit nobody was looking at.
|
|
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
|
|
git remote add github "https://x-access-token:${GH_TOKEN}@github.com/Expressive-Tea/green-tea.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 (AGENTS.md, External contributions); never force this push."
|
|
exit 1
|
|
fi
|