{"id":18282973,"url":"https://github.com/zentered/gh-deployer","last_synced_at":"2025-07-02T22:36:48.998Z","repository":{"id":166254651,"uuid":"641701339","full_name":"zentered/gh-deployer","owner":"zentered","description":"GitHub Deployment Manager","archived":false,"fork":false,"pushed_at":"2023-05-26T04:46:38.000Z","size":34,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T18:57:06.085Z","etag":null,"topics":["cloud-build","github-deployment","google-cloud-platform"],"latest_commit_sha":null,"homepage":"https://zentered.co/articles/preview-builds-with-cloud-run/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zentered.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-17T01:52:33.000Z","updated_at":"2024-12-13T19:28:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"9dded37f-99a7-4e8c-bef0-cdd40d3e739d","html_url":"https://github.com/zentered/gh-deployer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zentered%2Fgh-deployer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zentered%2Fgh-deployer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zentered%2Fgh-deployer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zentered%2Fgh-deployer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zentered","download_url":"https://codeload.github.com/zentered/gh-deployer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530609,"owners_count":21119591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-build","github-deployment","google-cloud-platform"],"created_at":"2024-11-05T13:06:53.021Z","updated_at":"2025-04-12T06:40:43.458Z","avatar_url":"https://github.com/zentered.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Deployer\n\nGitHub Deployer is a Docker image that can be used to interact with the\n[GitHub Deployments API](https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment).\n\n**Background and full article**:\nhttps://zentered.co/articles/preview-builds-with-cloud-run/\n\n## Usage\n\nThis code is meant to be used in a CI/CD pipeline to interact with the GitHub\nDeployments API. You need to have or create a GitHub App and build the Docker\nimage yourself.\n\n### GitHub App\n\nGitHub Deployer uses a GitHub App to authenticate with GitHub. You can create\nyour own GitHub App in the Developer Settings of your GitHub account.\n\nThe following permissions are needed:\n\n- `deployments`\n- `pull_requests`\n- `contents`\n\nCreate \u0026 download the private key and run:\n\n```bash\nbase64 -i your.private-key.pem\n```\n\nThis is the value you need to set for the `GH_APP_PRIVATE_KEY` environment.\n\n### Docker Build\n\nAn example to build \u0026 push the image to Google Cloud Artifact Registry. The\nstatic GitHub variables are \"baked in\" the image to simplify the calls in the\nCI.\n\n```bash\ndocker buildx build --platform linux/amd64 . -t us-central1-docker.pkg.dev/[your-project]/docker/gh-deployer \\\n  --build-arg GH_APP_ID=111111 \\\n  --build-arg GH_APP_INSTALLATION_ID=111111 \\\n  --build-arg GH_APP_PRIVATE_KEY=111111 \\\n  --build-arg GH_OWNER=zentered\n\ndocker push us-central1-docker.pkg.dev/[your-project]/docker/gh-deployer\n```\n\n#### Build Variables\n\n| Name                   | Description                  | Required | Default |\n| ---------------------- | ---------------------------- | -------- | ------- |\n| GH_APP_ID              | GitHub App ID                | Yes      |         |\n| GH_APP_INSTALLATION_ID | GitHub App Installation ID   | Yes      |         |\n| GH_APP_PRIVATE_KEY     | GitHub App Key               | Yes      |         |\n| GH_OWNER               | GitHub Owner (ie `zentered`) | Yes      |         |\n\n#### Environment Variables\n\n| Name                  | Description                                                                     | Required | Default |\n| --------------------- | ------------------------------------------------------------------------------- | -------- | ------- |\n| REPO_NAME             | GitHub Repo (ie `gh-deployer`)                                                  | Yes      |         |\n| REF                   | GitHub Ref (this should be the SHA in your deployment step)                     | Yes      |         |\n| ENVIRONMENT           | Environment (ie `production`)                                                   | Yes      |         |\n| TRANSIENT_ENVIRONMENT | Transient Environment (is the deployment temporary [true] or permanent [false]) | No       | `false` |\n| DESCRIPTION           | Description of the deployment                                                   | No       |         |\n\n### GitHub Deployment \u0026 Deployment Status\n\nThe first step is to create a new deployment for a given sha or branch with the\n`create` command. This will return a deployment ID that you can store in the\nworkspace of your CI. Afterwards you create \"Deployment Status\" events with the\ndeployment URL:\n\n- 'error'\n- 'failure'\n- 'pending'\n- 'in_progress'\n- 'queued'\n- 'success'\n\n## Example\n\n### Create Deployment\n\n```bash\ndocker run \\\n  -e REF=3b2fae5 \\\n  -e ENVIRONMENT=production \\\n  -e TRANSIENT_ENVIRONMENT=false \\\n  -e DESCRIPTION=\"Deploying to production\" \\\n  zentered/gh-deployer\n  create\n```\n\n### Create Deployment Status (In Progress)\n\n```bash\ndocker run \\\n  -e REF=3b2fae5 \\\n  -e ENVIRONMENT=production \\\n  -e TRANSIENT_ENVIRONMENT=false \\\n  -e DESCRIPTION=\"Deploying to production\" \\\n  zentered/gh-deployer\n  in_progress\n  111111\n```\n\n### Create Deployment Status (Success with Deployment URL)\n\n```bash\ndocker run \\\n  -e REF=3b2fae5 \\\n  -e ENVIRONMENT=production \\\n  -e TRANSIENT_ENVIRONMENT=false \\\n  -e DESCRIPTION=\"Deploying to production\" \\\n  zentered/gh-deployer\n  success\n  111111\n  https://zentered.co\n```\n\n## Use with Google Cloud Platform\n\n1. Create a new Docker repository in\n   [Artifact Registry](https://console.cloud.google.com/artifacts)\n2. Build, tag \u0026 push to the repository\n3. Use the image in Cloud Build\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzentered%2Fgh-deployer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzentered%2Fgh-deployer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzentered%2Fgh-deployer/lists"}