Skip to content

Commit bdff1da

Browse files
EDI-ify "Using environments for deployment" (#56595)
Co-authored-by: Joe Clark <[email protected]>
1 parent 47ff887 commit bdff1da

File tree

4 files changed

+52
-16
lines changed

4 files changed

+52
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
---
2-
title: Using environments for deployment
3-
shortTitle: Environments
4-
intro: Specify a deployment environment in your workflow.
2+
title: Deployment environments
3+
intro: 'You can create and deploy to different environments.'
54
versions:
65
fpt: '*'
76
ghes: '*'
87
ghec: '*'
9-
redirect_from:
10-
- /actions/using-jobs/using-environments-for-jobs
11-
- /actions/using-jobs/using-environments-for-deployment
12-
- /actions/writing-workflows/choosing-what-your-workflow-does/using-environments-for-deployment
8+
type: overview
9+
topics:
10+
- Actions
11+
- Workflows
1312
---
14-
15-
{% data reusables.actions.enterprise-github-hosted-runners %}
16-
17-
## About environments
1813

1914
{% data reusables.actions.about-environments %}
2015

2116
Each job in a workflow can reference a single environment. Any protection rules configured for the environment must pass before a job referencing the environment is sent to a runner. The job can access the environment's secrets only after the job is sent to a runner.
2217

2318
When a workflow references an environment, the environment will appear in the repository's deployments. For more information about viewing current and previous deployments, see [AUTOTITLE](/actions/deployment/managing-your-deployments/viewing-deployment-history).
24-
25-
## Using an environment in a workflow
26-
27-
{% data reusables.actions.environment-example %}

content/actions/concepts/workflows-and-actions/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ children:
1313
- /about-custom-actions
1414
- /contexts
1515
- /expressions
16+
- /deployment-environments
1617
- /dependency-caching
1718
- /about-monitoring-workflows
1819
- /notifications-for-workflow-runs
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: Deploying to a specific environment
3+
shortTitle: Deploy to environment
4+
intro: Specify a deployment environment in your workflow.
5+
versions:
6+
fpt: '*'
7+
ghes: '*'
8+
ghec: '*'
9+
redirect_from:
10+
- /actions/using-jobs/using-environments-for-jobs
11+
- /actions/using-jobs/using-environments-for-deployment
12+
- /actions/writing-workflows/choosing-what-your-workflow-does/using-environments-for-deployment
13+
- /actions/how-tos/writing-workflows/choosing-what-your-workflow-does/using-environments-for-deployment
14+
---
15+
16+
## Prerequisites
17+
18+
You need to create an environment before you can use it in a workflow. See [AUTOTITLE](/actions/how-tos/managing-workflow-runs-and-deployments/managing-deployments/managing-environments-for-deployment#creating-an-environment).
19+
20+
## Using an environment in a workflow
21+
22+
1. Open the workflow file you want to edit.
23+
1. Use the following syntax to add a [`jobs.<job_id>.environment`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenvironment) key to your workflow:
24+
25+
```yaml copy
26+
jobs:
27+
JOB-ID:
28+
environment: ENVIRONMENT-NAME
29+
```
30+
31+
The chosen job will now be subject to any rules configured for the specified environment.
32+
1. Optionally, specify a deployment URL for the environment using the following syntax:
33+
34+
```yaml copy
35+
jobs:
36+
JOB-ID:
37+
environment: ENVIRONMENT-NAME
38+
url: URL
39+
```
40+
41+
The specified URL will appear:
42+
* On the deployments page for the repository
43+
* In the visualization graph for the workflow run
44+
* (If a pull request triggers the workflow) As a "View deployment" button in the pull request timeline

content/actions/how-tos/writing-workflows/choosing-what-your-workflow-does/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ children:
1818
- /store-information-in-variables
1919
- /passing-information-between-jobs
2020
- /setting-a-default-shell-and-working-directory
21-
- /using-environments-for-deployment
21+
- /deploying-to-a-specific-environment
2222
- /control-the-concurrency-of-workflows-and-jobs
2323
- /running-variations-of-jobs-in-a-workflow
2424
- /storing-and-sharing-data-from-a-workflow

0 commit comments

Comments
 (0)