Diffinery

homeflare/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

Deploy on GitHub pushes when DEPLOY_ON_PUSH is true

The Deploy workflow only ran on pushes when the repository lived on a
Diffinery instance, so a copy that lives on GitHub had to start every
deploy by hand. The repository variable DEPLOY_ON_PUSH opts a GitHub
copy in; mirrors of a repository that deploys from Diffinery leave it
unset so nothing deploys twice.
codician-team authored 1 parent 754895acommit 60157c9a3fb54641c6c049b171ebdcccceab3360Browse files
2 files changed+6−3
modified.github/workflows/deploy.yml+5−2View file
@@ -7,6 +7,7 @@
77 # DIFFINERY_ZONE the Cloudflare zone for the route (default: the domain's last two labels)
88 # MAIL_DOMAIN sends from notifications@<MAIL_DOMAIN> (default DIFFINERY_DOMAIN)
99 # ACCESS_TEAM_DOMAIN e.g. example.cloudflareaccess.com
10+# DEPLOY_ON_PUSH "true" deploys every push to main on GitHub too (Diffinery always does)
1011 #
1112 # It deploys a main commit only once CI (typecheck, unit tests and the Worker bundle) has
1213 # passed on it, so it doesn't run those itself. End-to-end tests run alongside the deploy.
@@ -34,8 +35,10 @@
3435 name: Main's current tip
3536 # Production deploys from Diffinery itself, on its own hosted runners (any
3637 # Diffinery, so self-hosted copies deploy themselves too). Running this
37- # workflow by hand on GitHub still deploys, as a fallback.
38- if: ${{ github.event_name == 'workflow_dispatch' || (github.server_url != 'https://github.com' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push') }}
38+ # workflow by hand on GitHub still deploys, as a fallback. On GitHub, pushes to
39+ # main deploy only when the repository variable DEPLOY_ON_PUSH is "true", so a
40+ # mirror of a repository that deploys elsewhere never deploys twice.
41+ if: ${{ github.event_name == 'workflow_dispatch' || ((github.server_url != 'https://github.com' || vars.DEPLOY_ON_PUSH == 'true') && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push') }}
3942 runs-on: ubuntu-latest
4043 timeout-minutes: 5
4144 outputs:
modifiedapps/diffinery/docs/self-hosting/deploy.md+1−1View file
@@ -68,7 +68,7 @@
6868 - `DIFFINERY_ZONE`, if the Cloudflare zone that holds your hostname is not its last two labels. For `git.example.com` the default zone is `example.com`, which is right; for `git.example.co.uk` the default would be `co.uk`, so set `DIFFINERY_ZONE` to `example.co.uk`.
6969 - `MAIL_DOMAIN`, if email should come from another domain than your hostname, for example `example.com` to send from `[email protected]`.
7070
71-The Deploy job runs on every push to `main` when your copy lives on a Diffinery instance, and whenever you start it by hand. On GitHub it doesn't run on pushes; start it by hand there (`workflow_dispatch`).
71+The Deploy job runs on every push to `main` when your copy lives on a Diffinery instance, and whenever you start it by hand. On GitHub it runs on pushes to `main` only when the repository variable `DEPLOY_ON_PUSH` is `true` (Settings > Secrets and variables > Actions > Variables), after the CI workflow passes on that commit. Without it, start the workflow by hand there (`workflow_dispatch`). Leave `DEPLOY_ON_PUSH` unset on a GitHub mirror of a repository that already deploys from Diffinery, or both would deploy.
7272
7373 The workflow doesn't pass `BOOTSTRAP_ADMINS`. Set the list with a first deploy from your machine (`scripts/setup.sh`), or put it under `vars` in your copy's `wrangler.jsonc`; after that, workflow deploys keep it.
7474