# Deploy on GitHub push questions

**URL:** <https://community.fly.io/t/deploy-on-github-push-questions/23085>\
**Category:** Questions / Help\
**Tags:** launch-ui, login-only\
**Created:** [December 18, 2024, 11:41pm UTC](https://community.fly.io/t/deploy-on-github-push-questions/23085 "2024-12-18T23:41:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottohara](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/scottohara/32/5202_2.png) [@scottohara](https://community.fly.io/u/scottohara)\
**Post date:** [December 18, 2024, 11:41pm UTC](https://community.fly.io/t/deploy-on-github-push-questions/23085/1 "2024-12-18T23:41:50Z")

</div>

I’m exploring the GitHub / [Fly.io](http://Fly.io) integration and Launch UI to figure out whether auto-deploy on push to GitHub is right for me.

My fly org has two apps, designated `staging` and `production`.  
Both apps share a single Github repo and a single `fly.toml` file.  
The shared `fly.toml` file omits the `app` key, and instead expects the `--app` argument to be provided at deploy time, indicating the target for the deployment:

```auto
fly deploy --app staging # deploy to staging
fly deploy --app production # deploy to production

```

### Question 1

From the Launch UI, when I connect the `staging` app to the GitHub repo (that has an existing `fly.toml` file with no `app` key), does it infer the `app` based on which Fly app it is connected to?

Or is it mandatory for the `app` key to be specified in `fly.toml` when using the GitHub integration?

### Question 2

When deploying with the CLI, my `Dockerfile` expects a `--build-arg` that indicates the base image version to use:

```auto
fly deploy --build-arg NODE_VERSION=X.y.z

```

```auto
# Dockerfile

ARG NODE_VERSION

FROM node:${NODE_VERSION}-alpine

```

The intention here is to replicate something similar to how Heroku’s nodejs buildpack works (which auto-detects the version of node to use from the `engines.node` property in `package.json`).

For reference, here’s what a Heroku build log looks like, showing it detecting the node/npm versions to use:

```auto
-----> Building on the Heroku-24 stack
-----> Deleting 15 files matching .slugignore patterns.
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
       
-----> Installing binaries
       engines.node (package.json): 22.11.0
       engines.npm (package.json): 10.9.1
       
       Resolving node version 22.11.0...
       Downloading and installing node 22.11.0...
       Bootstrapping npm 10.9.1 (replacing 10.9.0)...
       npm 10.9.1 installed

```

My deploy commands are defined as npm scripts that read the `engines.node` version and pass it as a `--build-arg`:

```json
{
  "scripts": {
    "deploy": "fly deploy --build-arg NODE_VERSION=$npm_package_engines_node",
    "deploy:staging": "npm run deploy -- --app staging",
    "deploy:production": "npm run deploy -- --app production"
  },
  "engines": {
    "node": "22.11.0"
  }
}

```

Of course, I could simply specify this in `fly.toml`:

```auto
[build.args]
  NODE_VERSION="22.11.0"

```

…but I’m trying to avoid having multiple places that need to be updated when the version of Node changes, and I like the idea of `engines.node` being the canonical place to store this.

With all that said, does this suggest that auto-deploy on push to GitHub is unlikely to work in my scenario given that I’m providing both `--app` and `--build-arg` at deploy time?

### Question 3

When linking the `staging` app and GitHub repo through the Launch UI, it creates a `production` environment in GitHub that deploys go to.

Can the GitHub environment name be changed to `staging`, or does the [Fly.io](http://Fly.io) integration specifically need an environment named `production`?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [December 25, 2024, 11:42pm UTC](https://community.fly.io/t/deploy-on-github-push-questions/23085/2 "2024-12-25T23:42:22Z")

</div>

Closed on December 25, 2024, 11:42pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
