Skip to content

Commit

Permalink
Revert "Revert "[April 13] serialization feature doc"" (github#18742)
Browse files Browse the repository at this point in the history
  • Loading branch information
skedwards88 authored Apr 19, 2021
1 parent 9923f16 commit 231635f
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 1 deletion.
3 changes: 3 additions & 0 deletions content/actions/reference/environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ For more information on syntax to reference environments in workflows, see "[Wor

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 "[Viewing deployment history](/developers/overview/viewing-deployment-history)."

### Using concurrency to serialize deployments in an environment
You can use concurrency so that an environment has a maximum of one deployment in progress and one deployment pending at a time. For more information, see "[Workflow syntax for GitHub Actions](/actions/reference/workflow-syntax-for-github-actions#concurrency)."

### Deleting an environment

{% data reusables.github-actions.permissions-statement-environment %}
Expand Down
34 changes: 33 additions & 1 deletion content/actions/reference/workflow-syntax-for-github-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,18 @@ defaults:
working-directory: scripts
```

{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" or currentVersion == "github-ae@next" %}
### `concurrency`

{% data reusables.actions.concurrency-beta %}

Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can only use the `github` context. For more information about expressions, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."

You can also specify `concurrency` at the job level. For more information, see [`jobs.<job_id>.concurrency`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idconcurrency).

{% data reusables.actions.actions-group-concurrency %}

{% endif %}
### `jobs`

A workflow run is made up of one or more jobs. Jobs run in parallel by default. To run jobs sequentially, you can define dependencies on other jobs using the `jobs.<job_id>.needs` keyword.
Expand Down Expand Up @@ -347,10 +359,11 @@ The environment that the job references. All environment protection rules must p
You can provide the environment as only the environment `name`, or as an environment object with the `name` and `url`. The URL maps to `environment_url` in the deployments API. For more information about the deployments API, see "[Deployments](/rest/reference/repos#deployments)."

##### Example using a single environment name

{% raw %}
```yaml
environment: staging_environment
```
{% endraw %}

##### Example using environment name and URL

Expand All @@ -372,6 +385,25 @@ environment:
{% endraw %}
{% endif %}


{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" or currentVersion == "github-ae@next" %}
### `jobs.<job_id>.concurrency`

{% data reusables.actions.concurrency-beta %}

{% note %}

**Note:** When concurrency is specified at the job level, order is not guaranteed for jobs or runs that queue within 5 minutes of each other.

{% endnote %}

Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the `secrets` context. For more information about expressions, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."

You can also specify `concurrency` at the workflow level. For more information, see [`concurrency`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#concurrency).

{% data reusables.actions.actions-group-concurrency %}

{% endif %}
### `jobs.<job_id>.outputs`

A `map` of outputs for a job. Job outputs are available to all downstream jobs that depend on this job. For more information on defining job dependencies, see [`jobs.<job_id>.needs`](#jobsjob_idneeds).
Expand Down
25 changes: 25 additions & 0 deletions data/reusables/actions/actions-group-concurrency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be `pending`. Any previously pending job or workflow in the concurrency group will be canceled. To also cancel any currently running job or workflow in the same concurrency group, specify `cancel-in-progress: true`.

##### Examples using concurrency and the default behavior

{% raw %}
```yaml
concurrency: staging_environment
```
{% endraw %}
{% raw %}
```yaml
concurrency: ci-${{ github.ref }}
```
{% endraw %}
##### Example using concurrency to cancel any in-progress job or run
{% raw %}
```yaml
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
```
{% endraw %}
5 changes: 5 additions & 0 deletions data/reusables/actions/concurrency-beta.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% note %}

**Note:** Concurrency is currently in beta and subject to change.

{% endnote %}

0 comments on commit 231635f

Please sign in to comment.