Skip to main content

Managing environments for deployment

You can create environments and secure those environments with deployment protection rules. A job that references an environment must follow any protection rules for the environment before running or accessing the environment's secrets.

๋ˆ„๊ฐ€ ์ด ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‚˜์š”?

Repository owners

Environments, environment secrets, and deployment protection rules are available in public repositories for all current GitHub plans. They are not available on legacy plans, such as Bronze, Silver, or Gold. For access to environments, environment secrets, and deployment branches in private or internal repositories, you must use GitHub Pro, GitHub Team, or GitHub Enterprise.

Prerequisites

Creating an environment

๊ฐœ์ธ ๊ณ„์ • ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์—์„œ ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•˜๋ ค๋ฉด ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์†Œ์œ ์ž์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์กฐ์ง ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์—์„œ ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•˜๋ ค๋ฉด admin ์•ก์„ธ์Šค ๊ถŒํ•œ์ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  1. GitHub์—์„œ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์˜ ๊ธฐ๋ณธ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

  2. ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์ด๋ฆ„ ์•„๋ž˜์—์„œ ์„ค์ •์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. "์„ค์ •" ํƒญ์ด ํ‘œ์‹œ๋˜์ง€ ์•Š์œผ๋ฉด ๋“œ๋กญ๋‹ค์šด ๋ฉ”๋‰ด๋ฅผ ์„ ํƒํ•œ ๋‹ค์Œ ์„ค์ •์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

    ํƒญ์„ ๋ณด์—ฌ ์ฃผ๋Š” ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ํ—ค๋”์˜ ์Šคํฌ๋ฆฐ์ƒท. "์„ค์ •" ํƒญ์ด ์ง„ํ•œ ์ฃผํ™ฉ์ƒ‰ ์œค๊ณฝ์„ ์œผ๋กœ ๊ฐ•์กฐ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

  3. ์™ผ์ชฝ ์‚ฌ์ด๋“œ๋ฐ”์—์„œ ํ™˜๊ฒฝ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  4. ์ƒˆ ํ™˜๊ฒฝ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  5. ํ™˜๊ฒฝ์˜ ์ด๋ฆ„์„ ์ž…๋ ฅํ•œ ๋‹ค์Œ ํ™˜๊ฒฝ ๊ตฌ์„ฑ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. ํ™˜๊ฒฝ ์ด๋ฆ„์€ ๋Œ€/์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ™˜๊ฒฝ ์ด๋ฆ„์€ 255์ž๋ฅผ ์ดˆ๊ณผํ•˜์ง€ ์•Š์•„์•ผ ํ•˜๋ฉฐ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ๋‚ด์—์„œ ๊ณ ์œ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  6. Optionally, specify people or teams that must approve workflow jobs that use this environment. For more information, see Deployments and environments.

    1. Select Required reviewers.
    2. Enter up to 6 people or teams. Only one of the required reviewers needs to approve the job for it to proceed.
    3. Optionally, to prevent users from approving workflows runs that they triggered, select Prevent self-review.
    4. Click Save protection rules.
  7. Optionally, specify the amount of time to wait before allowing workflow jobs that use this environment to proceed. For more information, see Deployments and environments.

    1. Select Wait timer.
    2. Enter the number of minutes to wait.
    3. Click Save protection rules.
  8. Optionally, disallow bypassing configured protection rules. For more information, see Deployments and environments.

    1. Deselect Allow administrators to bypass configured protection rules.
    2. Click Save protection rules.
  9. Optionally, enable any custom deployment protection rules that have been created with GitHub Apps. For more information, see Deployments and environments.

    1. Select the custom protection rule you want to enable.
    2. Click Save protection rules.
  10. Optionally, specify what branches and tags can deploy to this environment. For more information, see Deployments and environments.

    1. Select the desired option in the Deployment branches dropdown.

    2. If you chose Selected branches and tags, to add a new rule, click Add deployment branch or tag rule

    3. In the "Ref type" dropdown menu, depending on what rule you want to apply, click Branch or Tag.

    4. Enter the name pattern for the branch or tag that you want to allow.

      ์ฐธ๊ณ  ํ•ญ๋ชฉ

      ์ด๋ฆ„ ํŒจํ„ด์€ ๋ถ„๊ธฐ๋‚˜ ํƒœ๊ทธ์— ๋Œ€ํ•ด ๊ฐœ๋ณ„์ ์œผ๋กœ ๊ตฌ์„ฑํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    5. Click Add rule.

  11. Optionally, add environment secrets. These secrets are only available to workflow jobs that use the environment. Additionally, workflow jobs that use this environment can only access these secrets after any configured rules (for example, required reviewers) pass. For more information, see Deployments and environments.

    1. Under Environment secrets, click Add Secret.
    2. Enter the secret name.
    3. Enter the secret value.
    4. Click Add secret.
  12. Optionally, add environment variables. These variables are only available to workflow jobs that use the environment, and are only accessible using the vars context. For more information, see Deployments and environments.

    1. Under Environment variables, click Add Variable.
    2. Enter the variable name.
    3. Enter the variable value.
    4. Click Add variable.

You can also create and configure environments through the REST API. For more information, see Deployment Environments์— ๋Œ€ํ•œ REST API ์—”๋“œํฌ์ธํŠธ, GitHub Actions ๋น„๋ฐ€์— ๋Œ€ํ•œ REST API ์—”๋“œํฌ์ธํŠธ, GitHub Actions ๋ณ€์ˆ˜์— ๋Œ€ํ•œ REST API ์—”๋“œํฌ์ธํŠธ, and ๋ฐฐํฌ ๋ถ„๊ธฐ ์ •์ฑ…์— ๋Œ€ํ•œ REST API ์—”๋“œํฌ์ธํŠธ.

Running a workflow that references an environment that does not exist will create an environment with the referenced name. If the environment is created from running implicit page builds (for example, from a branch or folder source), the source branch will be added as a protection rule to the environment. Otherwise, the newly created environment will not have any protection rules or secrets configured. Anyone that can edit workflows in the repository can create environments via a workflow file, but only repository admins can configure the environment.

Deleting an environment

๊ฐœ์ธ ๊ณ„์ • ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์—์„œ ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•˜๋ ค๋ฉด ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์†Œ์œ ์ž์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์กฐ์ง ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์—์„œ ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•˜๋ ค๋ฉด admin ์•ก์„ธ์Šค ๊ถŒํ•œ์ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Deleting an environment will delete all secrets and protection rules associated with the environment. Any jobs currently waiting because of protection rules from the deleted environment will automatically fail.

  1. GitHub์—์„œ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์˜ ๊ธฐ๋ณธ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

  2. ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์ด๋ฆ„ ์•„๋ž˜์—์„œ ์„ค์ •์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. "์„ค์ •" ํƒญ์ด ํ‘œ์‹œ๋˜์ง€ ์•Š์œผ๋ฉด ๋“œ๋กญ๋‹ค์šด ๋ฉ”๋‰ด๋ฅผ ์„ ํƒํ•œ ๋‹ค์Œ ์„ค์ •์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

    ํƒญ์„ ๋ณด์—ฌ ์ฃผ๋Š” ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ํ—ค๋”์˜ ์Šคํฌ๋ฆฐ์ƒท. "์„ค์ •" ํƒญ์ด ์ง„ํ•œ ์ฃผํ™ฉ์ƒ‰ ์œค๊ณฝ์„ ์œผ๋กœ ๊ฐ•์กฐ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

  3. ์™ผ์ชฝ ์‚ฌ์ด๋“œ๋ฐ”์—์„œ ํ™˜๊ฒฝ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  4. Next to the environment that you want to delete, click .

  5. Click I understand, delete this environment.

You can also delete environments through the REST API. For more information, see ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์— ๋Œ€ํ•œ REST API ์—”๋“œํฌ์ธํŠธ.

How environments relate to deployments

ํ™˜๊ฒฝ์„ ์ฐธ์กฐํ•˜๋Š” ์›Œํฌํ”Œ๋กœ ์ž‘์—…์ด ์‹คํ–‰๋˜๋ฉด ํ™˜๊ฒฝ ์ด๋ฆ„์œผ๋กœ ์„ค์ •๋œ environment ์†์„ฑ์ด ์žˆ๋Š” ๋ฐฐํฌ ๊ฐœ์ฒด๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค. ์›Œํฌํ”Œ๋กœ๊ฐ€ ์ง„ํ–‰๋จ์— ๋”ฐ๋ผ ํ™˜๊ฒฝ ์ด๋ฆ„์œผ๋กœ ์„ค์ •๋œ environment ์†์„ฑ, ํ™˜๊ฒฝ์˜ URL๋กœ ์„ค์ •๋œ environment_url ์†์„ฑ(์›Œํฌํ”Œ๋กœ์— ์ง€์ •๋œ ๊ฒฝ์šฐ), ์ž‘์—…์˜ ์ƒํƒœ๋กœ ์„ค์ •๋œ state ์†์„ฑ์ด ์žˆ๋Š” ๋ฐฐํฌ ์ƒํƒœ ๊ฐœ์ฒด๋„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

You can access these objects through the REST API or GraphQL API. You can also subscribe to these webhook events. For more information, see ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์— ๋Œ€ํ•œ REST API ์—”๋“œํฌ์ธํŠธ, ๊ฐœ์ฒด (GraphQL API), or ์›นํ›„ํฌ ์ด๋ฒคํŠธ ๋ฐ ํŽ˜์ด๋กœ๋“œ.

Next steps

GitHub Actions provides several features for managing your deployments. For more information, see Deploying with GitHub Actions.