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 # # `--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@v4 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