Merge branch 'main' into patch-1
|
@ -22,7 +22,7 @@ Check to make sure someone hasn't already opened a similar issue: https://github
|
|||
|
||||
### What is the current behavior?
|
||||
|
||||
<!-- include links to articles where you're seeing a problem, screenshots, what browser you're using, etc. -->
|
||||
<!-- Include links to articles where you're seeing a problem, screenshots, what browser you're using, etc. -->
|
||||
|
||||
### What changes are you suggesting?
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ module.exports = [
|
|||
'actions/stale@af4072615903a8b031f986d25b1ae3bf45ec44d4', //actions/stale@v3.0.13
|
||||
'crowdin/github-action@fd9429dd63d6c0f8a8cb4b93ad8076990bd6e688',
|
||||
'crykn/copy_folder_to_another_repo_action@abc264e1c16eb3d7b1f7763bfdb0e1699ad43120',
|
||||
'cschleiden/actions-linter@43fd4e08e52ed40c0e2782dc2425694388851576',
|
||||
'dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911',
|
||||
'docker://chinthakagodawita/autoupdate-action:v1',
|
||||
'fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289',
|
||||
|
@ -20,7 +21,7 @@ module.exports = [
|
|||
'github/codeql-action/init@v1',
|
||||
'ianwalter/puppeteer@12728ddef82390d1ecd4732fb543f62177392fbb',
|
||||
'juliangruber/approve-pull-request-action@c530832d4d346c597332e20e03605aa94fa150a8',
|
||||
'juliangruber/find-pull-request-action@64d55773c959748ad30a4184f4dc102af1669f7b',
|
||||
'juliangruber/find-pull-request-action@2fc55e82a6d5d36fe1e7f1848f7e64fd02d99de9',
|
||||
'juliangruber/read-file-action@e0a316da496006ffd19142f0fd594a1783f3b512',
|
||||
'lee-dohm/close-matching-issues@22002609b2555fe18f52b8e2e7c07cbf5529e8a8',
|
||||
'pascalgn/automerge-action@c9bd182',
|
||||
|
|
|
@ -7,7 +7,7 @@ jobs:
|
|||
autoupdate:
|
||||
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
|
||||
name: autoupdate
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: docker://chinthakagodawita/autoupdate-action:v1
|
||||
env:
|
||||
|
|
|
@ -2,9 +2,11 @@ name: CodeQL analysis
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: main
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches: main
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '**/*.js'
|
||||
- '.github/workflows/codeql.yml'
|
||||
|
|
|
@ -58,12 +58,13 @@ jobs:
|
|||
github_token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
|
||||
- name: Find pull request
|
||||
uses: juliangruber/find-pull-request-action@64d55773c959748ad30a4184f4dc102af1669f7b
|
||||
uses: juliangruber/find-pull-request-action@2fc55e82a6d5d36fe1e7f1848f7e64fd02d99de9
|
||||
id: find-pull-request
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: repo-sync
|
||||
base: main
|
||||
author: Octomerger
|
||||
|
||||
- name: Approve pull request
|
||||
if: ${{ steps.find-pull-request.outputs.number }}
|
||||
|
|
|
@ -8,6 +8,8 @@ on:
|
|||
- main
|
||||
types:
|
||||
- closed
|
||||
paths:
|
||||
- 'content/github/site-policy/**'
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
@ -33,8 +35,8 @@ jobs:
|
|||
with:
|
||||
source_folder: 'content/github/site-policy'
|
||||
destination_repo: 'github/site-policy'
|
||||
destination_branch: 'non-substantive-changes'
|
||||
destination_branch: 'repo-sync'
|
||||
destination_folder: 'Policies'
|
||||
user_email: 'pcihon@users.noreply.github.com'
|
||||
user_name: 'pcihon'
|
||||
commit_msg: 'Mirroring non-substantive changes.'
|
||||
commit_msg: 'Automatic sync from GitHub Docs.'
|
||||
|
|
|
@ -4,12 +4,14 @@ name: Node.js Tests - Windows
|
|||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '50 19 * * *' # once a day at 19:50 UTC / 11:50 PST
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: windows-latest
|
||||
if: (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'Windows') || contains(github.event.pull_request.labels.*.name, 'windows')))
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
|
|
@ -17,11 +17,13 @@ jobs:
|
|||
echo 'The repo is currently frozen! Exiting this workflow.'
|
||||
exit 1 # prevents further steps from running
|
||||
- name: Find original Pull Request
|
||||
uses: juliangruber/find-pull-request-action@64d55773c959748ad30a4184f4dc102af1669f7b
|
||||
uses: juliangruber/find-pull-request-action@2fc55e82a6d5d36fe1e7f1848f7e64fd02d99de9
|
||||
id: pr
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: translations
|
||||
base: main
|
||||
author: octoglot
|
||||
- if: ${{ steps.pr.outputs.number }}
|
||||
name: Check if already labeled
|
||||
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
|
|
|
@ -104,6 +104,8 @@ jobs:
|
|||
body: reviewMessage,
|
||||
event: 'REQUEST_CHANGES'
|
||||
})
|
||||
|
||||
core.setFailed("It looks like you've modified some files we don't accept contributions for. Please see the review with requested changes for details.")
|
||||
# When the most recent review was CHANGES_REQUESTED and the existing
|
||||
# PR no longer contains unallowed changes, dismiss the previous review
|
||||
- name: Dismiss pull request review
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
name: Lint workflows
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# branches:
|
||||
# - main
|
||||
# pull_request:
|
||||
# branches-ignore:
|
||||
# - translations
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
||||
|
||||
- name: Run linter
|
||||
uses: cschleiden/actions-linter@43fd4e08e52ed40c0e2782dc2425694388851576
|
||||
with:
|
||||
workflows: '[".github/workflows/*.yml"]'
|
|
@ -18,7 +18,7 @@ We accept a lot of [different contributions](CONTRIBUTING.md/#types-of-contribut
|
|||
|
||||
#### Click **make a contribution** from docs
|
||||
|
||||
As you're using the GitHub Docs, you may find something in an article that you'd like to add to, update, or change. Click on **make a contribution** to navigate directly to that article in the codebase, so that you can begin making your contribution.
|
||||
As you're using GitHub Docs, you may find something in an article that you'd like to add to, update, or change. Click on **make a contribution** to navigate directly to that article in the codebase, so that you can begin making your contribution.
|
||||
|
||||
<img src="./assets/images/contribution_cta.png" width="400">
|
||||
|
||||
|
|
После Ширина: | Высота: | Размер: 106 KiB |
После Ширина: | Высота: | Размер: 47 KiB |
Двоичные данные
assets/images/enterprise/management-console/actions-minio-force-path-style.png
Normal file
После Ширина: | Высота: | Размер: 62 KiB |
Двоичные данные
assets/images/enterprise/management-console/actions-minio-s3-storage.png
Normal file
После Ширина: | Высота: | Размер: 104 KiB |
После Ширина: | Высота: | Размер: 42 KiB |
До Ширина: | Высота: | Размер: 10 KiB После Ширина: | Высота: | Размер: 70 KiB |
До Ширина: | Высота: | Размер: 10 KiB После Ширина: | Высота: | Размер: 70 KiB |
После Ширина: | Высота: | Размер: 70 KiB |
Двоичные данные
assets/images/enterprise/management-console/enable-secret-scanning-checkbox.png
Normal file
После Ширина: | Высота: | Размер: 8.8 KiB |
После Ширина: | Высота: | Размер: 9.0 KiB |
Двоичные данные
assets/images/enterprise/management-console/select-enable-github-mobile-apps.png
Normal file
После Ширина: | Высота: | Размер: 60 KiB |
После Ширина: | Высота: | Размер: 26 KiB |
До Ширина: | Высота: | Размер: 7.8 KiB После Ширина: | Высота: | Размер: 22 KiB |
До Ширина: | Высота: | Размер: 9.3 KiB После Ширина: | Высота: | Размер: 19 KiB |
Двоичные данные
assets/images/enterprise/site-admin-settings/add-mandatory-message-button.png
Normal file
После Ширина: | Высота: | Размер: 19 KiB |
Двоичные данные
assets/images/enterprise/site-admin-settings/edit-message.png
До Ширина: | Высота: | Размер: 56 KiB После Ширина: | Высота: | Размер: 20 KiB |
Двоичные данные
assets/images/enterprise/site-admin-settings/mandatory-message-text-box.png
Normal file
После Ширина: | Высота: | Размер: 56 KiB |
После Ширина: | Высота: | Размер: 8.0 KiB |
Двоичные данные
assets/images/enterprise/site-admin-settings/message-save-changes-button.png
Normal file
После Ширина: | Высота: | Размер: 7.9 KiB |
До Ширина: | Высота: | Размер: 20 KiB После Ширина: | Высота: | Размер: 20 KiB |
Двоичные данные
assets/images/help/branch/branch-rename-rename.png
До Ширина: | Высота: | Размер: 30 KiB После Ширина: | Высота: | Размер: 412 KiB |
Двоичные данные
assets/images/help/branch/branch-rename-type.png
До Ширина: | Высота: | Размер: 30 KiB После Ширина: | Высота: | Размер: 147 KiB |
Двоичные данные
assets/images/help/business-accounts/billing-license-info-click-view-details-or-download.png
Normal file
После Ширина: | Высота: | Размер: 28 KiB |
Двоичные данные
assets/images/help/business-accounts/billing-license-info.png
До Ширина: | Высота: | Размер: 52 KiB После Ширина: | Высота: | Размер: 135 KiB |
После Ширина: | Высота: | Размер: 3.4 KiB |
После Ширина: | Высота: | Размер: 24 KiB |
После Ширина: | Высота: | Размер: 21 KiB |
Двоичные данные
assets/images/help/organizations/security-and-analysis-disable-or-enable-all-ghe.png
Normal file
После Ширина: | Высота: | Размер: 43 KiB |
Двоичные данные
assets/images/help/organizations/security-and-analysis-disable-or-enable-secret-scanning-ghe.png
Normal file
После Ширина: | Высота: | Размер: 21 KiB |
Двоичные данные
assets/images/help/organizations/security-and-analysis-enable-or-disable-secret-scanning-checkbox-ghe.png
Normal file
После Ширина: | Высота: | Размер: 19 KiB |
Двоичные данные
assets/images/help/organizations/security-and-analysis-enable-secret-scanning-ghe.png
Normal file
После Ширина: | Высота: | Размер: 15 KiB |
Двоичные данные
assets/images/help/organizations/security-and-analysis-secret-scanning-enable-by-default-ghe.png
Normal file
После Ширина: | Высота: | Размер: 15 KiB |
После Ширина: | Высота: | Размер: 19 KiB |
После Ширина: | Высота: | Размер: 8.5 KiB |
После Ширина: | Высота: | Размер: 240 KiB |
После Ширина: | Высота: | Размер: 53 KiB |
После Ширина: | Высота: | Размер: 17 KiB |
После Ширина: | Высота: | Размер: 15 KiB |
Двоичные данные
assets/images/help/repository/code-scanning-click-alert.png
До Ширина: | Высота: | Размер: 29 KiB После Ширина: | Высота: | Размер: 73 KiB |
До Ширина: | Высота: | Размер: 39 KiB После Ширина: | Высота: | Размер: 92 KiB |
После Ширина: | Высота: | Размер: 9.5 KiB |
После Ширина: | Высота: | Размер: 9.6 KiB |
Двоичные данные
assets/images/help/repository/enable-dependabot-security-updates-button.png
Normal file
После Ширина: | Высота: | Размер: 67 KiB |
До Ширина: | Высота: | Размер: 48 KiB |
После Ширина: | Высота: | Размер: 38 KiB |
После Ширина: | Высота: | Размер: 3.0 KiB |
После Ширина: | Высота: | Размер: 14 KiB |
Двоичные данные
assets/images/help/repository/secret-scanning-click-alert.png
До Ширина: | Высота: | Размер: 18 KiB После Ширина: | Высота: | Размер: 26 KiB |
После Ширина: | Высота: | Размер: 27 KiB |
Двоичные данные
assets/images/help/repository/secret-scanning-resolve-alert.png
До Ширина: | Высота: | Размер: 17 KiB После Ширина: | Высота: | Размер: 31 KiB |
Двоичные данные
assets/images/help/repository/security-and-analysis-disable-or-enable-ghe.png
Normal file
После Ширина: | Высота: | Размер: 38 KiB |
Двоичные данные
assets/images/help/repository/security-and-analysis-security-alerts-person-or-team-search-ghe.png
Normal file
После Ширина: | Высота: | Размер: 33 KiB |
Двоичные данные
assets/images/help/repository/security-and-analysis-security-alerts-username-x-ghe.png
Normal file
После Ширина: | Высота: | Размер: 37 KiB |
Двоичные данные
assets/images/help/sponsors/export-all.png
До Ширина: | Высота: | Размер: 10 KiB После Ширина: | Высота: | Размер: 13 KiB |
Двоичные данные
assets/images/help/sponsors/export-your-sponsors.png
До Ширина: | Высота: | Размер: 48 KiB После Ширина: | Высота: | Размер: 100 KiB |
Двоичные данные
assets/images/help/sponsors/filter-drop-down.png
До Ширина: | Высота: | Размер: 23 KiB После Ширина: | Высота: | Размер: 32 KiB |
|
@ -24,6 +24,7 @@ See the [contributing docs](/CONTRIBUTING.md) for general information about work
|
|||
- [Escaping single quotes](#escaping-single-quotes)
|
||||
- [Autogenerated mini TOCs](#autogenerated-mini-tocs)
|
||||
- [Versioning](#versioning)
|
||||
- [Free-pro-team vs. GitHub.com versioning](#free-pro-team-vs.-github.com-versioning)
|
||||
- [Filenames](#filenames)
|
||||
- [Whitespace control](#whitespace-control)
|
||||
- [Links and image paths](#links-and-image-paths)
|
||||
|
@ -213,6 +214,12 @@ A content file can have **two** types of versioning:
|
|||
* Liquid statements in content (**optional**)
|
||||
* Conditionally render content depending on the current version being viewed. See [contributing/liquid-helpers](../contributing/liquid-helpers.md) for more info. Note Liquid conditionals can also appear in `data` and `include` files.
|
||||
|
||||
### Free-pro-team vs. GitHub.com versioning
|
||||
|
||||
As of early 2021, the `free-pro-team@latest` version is **only** supported in content files (in both frontmatter and Liquid versioning) and throughout the docs site backend. It is **not** user facing. A helper function called `lib/remove-fpt-from-path.js` removes the version from URLs. Users now select `GitHub.com` in the Article Versions dropdown instead of `Free, Pro, Team`.
|
||||
|
||||
The convenience function allows us to continue supporting a consistent versioning structure under-the-hood while not displaying plan information to users that may be potentially confusing.
|
||||
|
||||
## Filenames
|
||||
|
||||
When adding a new article, make sure the filename is a [kebab-cased](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) version of the title you use in the article's [`title`](#title) frontmatter. This can get tricky when a title has punctuation (such as "GitHub's Billing Plans"). A test will flag any discrepancies between title and filename. To override this requirement for a given article, you can add [`allowTitleToDifferFromFilename`](#allowtitletodifferfromfilename) frontmatter.
|
||||
|
@ -224,7 +231,7 @@ When using Liquid conditionals in lists or tables, you can use [whitespace contr
|
|||
Just add a hyphen on either the left, right, or both sides to indicate that there should be no newline on that side. For example, this statement removes a newline on the left side:
|
||||
|
||||
```
|
||||
{%- if page.version == 'dotcom' %}
|
||||
{%- if currentVersion == 'free-pro-team@latest' %}
|
||||
```
|
||||
|
||||
These characters are especially important in [index pages](#index-pages) comprised of list items.
|
||||
|
@ -238,9 +245,9 @@ For example, if you include the following link in a content file:
|
|||
```
|
||||
/github/writing-on-github/creating-a-saved-reply
|
||||
```
|
||||
When viewed on GitHub.com docs, the link gets rendered with the language code and version:
|
||||
When viewed on GitHub.com docs, the link gets rendered with the language code:
|
||||
```
|
||||
/en/free-pro-team@latest/github/writing-on-github/creating-a-saved-reply
|
||||
/en/github/writing-on-github/creating-a-saved-reply
|
||||
```
|
||||
and when viewed on GitHub Enterprise Server docs, the version is included as well:
|
||||
```
|
||||
|
@ -262,7 +269,7 @@ https://github-images.s3.amazonaws.com/enterprise/2.20/assets/images/help/profil
|
|||
|
||||
Sometimes you want to link to a Dotcom-only article in Enterprise content and you don't want the link to be Enterprise-ified. To prevent the transformation, write the link using HTML and add a class of `dotcom-only`. For example:
|
||||
|
||||
```
|
||||
```html
|
||||
<a href="/github/site-policy/github-terms-of-service" class="dotcom-only">GitHub's Terms of Service</a>
|
||||
```
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ Before you begin, you'll need to create a GitHub repository.
|
|||
|
||||
1. From your terminal, change directories into your new repository.
|
||||
|
||||
```shell
|
||||
```shell{:copy}
|
||||
cd hello-world-docker-action
|
||||
```
|
||||
|
||||
|
@ -48,7 +48,7 @@ Before you begin, you'll need to create a GitHub repository.
|
|||
In your new `hello-world-docker-action` directory, create a new `Dockerfile` file. For more information, see "[Dockerfile support for {% data variables.product.prodname_actions %}](/actions/creating-actions/dockerfile-support-for-github-actions)."
|
||||
|
||||
**Dockerfile**
|
||||
```dockerfile
|
||||
```dockerfile{:copy}
|
||||
# Container image that runs your code
|
||||
FROM alpine:3.10
|
||||
|
||||
|
@ -65,7 +65,7 @@ Create a new `action.yml` file in the `hello-world-docker-action` directory you
|
|||
|
||||
{% raw %}
|
||||
**action.yml**
|
||||
```yaml
|
||||
```yaml{:copy}
|
||||
# action.yml
|
||||
name: 'Hello World'
|
||||
description: 'Greet someone and record the time'
|
||||
|
@ -93,29 +93,28 @@ This metadata defines one `who-to-greet` input and one `time` output parameter.
|
|||
|
||||
You can choose any base Docker image and, therefore, any language for your action. The following shell script example uses the `who-to-greet` input variable to print "Hello [who-to-greet]" in the log file.
|
||||
|
||||
Next, the script gets the current time and sets it as an output variable that actions running later in a job can use. In order for {% data variables.product.prodname_dotcom %} to recognize output variables, you must use a workflow command in a specific syntax: `echo "::set-output name=<output name>::<value>"`. For more information, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter)."
|
||||
Next, the script gets the current time and sets it as an output variable that actions running later in a job can use. In order for {% data variables.product.prodname_dotcom %} to recognize output variables, you must use a workflow command in a specific syntax: `echo "::set-output name=<output name>::<value>"`. For more information, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter)."
|
||||
|
||||
1. Create a new `entrypoint.sh` file in the `hello-world-docker-action` directory.
|
||||
|
||||
1. Make your `entrypoint.sh` file executable:
|
||||
|
||||
```shell
|
||||
chmod +x entrypoint.sh
|
||||
```
|
||||
|
||||
1. Add the following code to your `entrypoint.sh` file.
|
||||
|
||||
**entrypoint.sh**
|
||||
```shell
|
||||
```shell{:copy}
|
||||
#!/bin/sh -l
|
||||
|
||||
echo "Hello $1"
|
||||
time=$(date)
|
||||
echo "::set-output name=time::$time"
|
||||
```
|
||||
|
||||
If `entrypoint.sh` executes without any errors, the action's status is set to `success`. You can also explicitly set exit codes in your action's code to provide an action's status. For more information, see "[Setting exit codes for actions](/actions/creating-actions/setting-exit-codes-for-actions)."
|
||||
|
||||
1. Make your `entrypoint.sh` file executable by running the following command on your system.
|
||||
|
||||
```shell{:copy}
|
||||
$ chmod +x entrypoint.sh
|
||||
```
|
||||
|
||||
### Creating a README
|
||||
|
||||
To let people know how to use your action, you can create a README file. A README is most helpful when you plan to share your action publicly, but is also a great way to remind you or your team how to use the action.
|
||||
|
@ -130,7 +129,7 @@ In your `hello-world-docker-action` directory, create a `README.md` file that sp
|
|||
- An example of how to use your action in a workflow.
|
||||
|
||||
**README.md**
|
||||
```markdown
|
||||
```markdown{:copy}
|
||||
# Hello world docker action
|
||||
|
||||
This action prints "Hello World" or "Hello" + the name of a person to greet to the log.
|
||||
|
@ -160,7 +159,7 @@ From your terminal, commit your `action.yml`, `entrypoint.sh`, `Dockerfile`, and
|
|||
|
||||
It's best practice to also add a version tag for releases of your action. For more information on versioning your action, see "[About actions](/actions/automating-your-workflow-with-github-actions/about-actions#using-release-management-for-actions)."
|
||||
|
||||
```shell
|
||||
```shell{:copy}
|
||||
git add action.yml entrypoint.sh Dockerfile README.md
|
||||
git commit -m "My first action is ready"
|
||||
git tag -a -m "My first action release" v1
|
||||
|
@ -175,11 +174,11 @@ Now you're ready to test your action out in a workflow. When an action is in a p
|
|||
|
||||
#### Example using a public action
|
||||
|
||||
The following workflow code uses the completed hello world action in the public [`actions/hello-world-docker-action`](https://github.com/actions/hello-world-docker-action) repository. Copy the following workflow example code into a `.github/workflows/main.yml` file, but replace the `actions/hello-world-docker-action` with your repository and action name. You can also replace the `who-to-greet` input with your name.
|
||||
The following workflow code uses the completed _hello world_ action in the public [`actions/hello-world-docker-action`](https://github.com/actions/hello-world-docker-action) repository. Copy the following workflow example code into a `.github/workflows/main.yml` file, but replace the `actions/hello-world-docker-action` with your repository and action name. You can also replace the `who-to-greet` input with your name. {% if currentVersion == "free-pro-team@latest" %}Public actions can be used even if they're not published to {% data variables.product.prodname_marketplace %}. For more information, see "[Publishing an action](/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action)." {% endif %}
|
||||
|
||||
{% raw %}
|
||||
**.github/workflows/main.yml**
|
||||
```yaml
|
||||
```yaml{:copy}
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
|
@ -200,11 +199,11 @@ jobs:
|
|||
|
||||
#### Example using a private action
|
||||
|
||||
Copy the following example workflow code into a `.github/workflows/main.yml` file in your action's repository. You can also replace the `who-to-greet` input with your name.
|
||||
Copy the following example workflow code into a `.github/workflows/main.yml` file in your action's repository. You can also replace the `who-to-greet` input with your name. {% if currentVersion == "free-pro-team@latest" %}This private action can't be published to {% data variables.product.prodname_marketplace %}, and can only be used in this repository.{% endif %}
|
||||
|
||||
{% raw %}
|
||||
**.github/workflows/main.yml**
|
||||
```yaml
|
||||
```yaml{:copy}
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
|
|
|
@ -48,20 +48,21 @@ The Docker `ENTRYPOINT` instruction has a _shell_ form and _exec_ form. The Dock
|
|||
|
||||
If you configure your container to use the _exec_ form of the `ENTRYPOINT` instruction, the `args` configured in the action's metadata file won't run in a command shell. If the action's `args` contain an environment variable, the variable will not be substituted. For example, using the following _exec_ format will not print the value stored in `$GITHUB_SHA`, but will instead print `"$GITHUB_SHA"`.
|
||||
|
||||
```
|
||||
```dockerfile
|
||||
ENTRYPOINT ["echo $GITHUB_SHA"]
|
||||
```
|
||||
|
||||
If you want variable substitution, then either use the _shell_ form or execute a shell directly. For example, using the following _exec_ format, you can execute a shell to print the value stored in the `GITHUB_SHA` environment variable.
|
||||
|
||||
```
|
||||
```dockerfile
|
||||
ENTRYPOINT ["sh", "-c", "echo $GITHUB_SHA"]
|
||||
````
|
||||
```
|
||||
|
||||
To supply `args` defined in the action's metadata file to a Docker container that uses the _exec_ form in the `ENTRYPOINT`, we recommend creating a shell script called `entrypoint.sh` that you call from the `ENTRYPOINT` instruction:
|
||||
|
||||
##### Example *Dockerfile*
|
||||
```
|
||||
|
||||
```dockerfile
|
||||
# Container image that runs your code
|
||||
FROM debian:9.5-slim
|
||||
|
||||
|
|
|
@ -41,11 +41,13 @@ For more information, see "[Creating a JavaScript action](/articles/creating-a-j
|
|||
|
||||
If you are creating a Docker container action, you can set a failure exit code in your `entrypoint.sh` script. For example:
|
||||
|
||||
{% raw %}
|
||||
```
|
||||
if <condition> ; then
|
||||
echo "Game over!"
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
For more information, see "[Creating a Docker container action](/articles/creating-a-docker-container-action)."
|
||||
|
|
|
@ -0,0 +1,248 @@
|
|||
---
|
||||
title: Building and testing .NET
|
||||
intro: You can create a continuous integration (CI) workflow to build and test your .NET project.
|
||||
product: '{% data reusables.gated-features.actions %}'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.22'
|
||||
---
|
||||
|
||||
### Introduction
|
||||
|
||||
This guide shows you how to build, test, and publish a .NET package.
|
||||
|
||||
{% data variables.product.prodname_dotcom %}-hosted runners have a tools cache with preinstalled software, which includes the .NET Core SDK. For a full list of up-to-date software and the preinstalled versions of .NET Core SDK, see [software installed on {% data variables.product.prodname_dotcom %}-hosted runners](/actions/reference/specifications-for-github-hosted-runners).
|
||||
|
||||
### Prerequisites
|
||||
|
||||
You should already be familiar with YAML syntax and how it's used with {% data variables.product.prodname_actions %}. For more information, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions)."
|
||||
|
||||
We recommend that you have a basic understanding of the .NET Core SDK. For more information, see [Getting started with .NET](https://dotnet.microsoft.com/learn).
|
||||
|
||||
### Starting with the .NET workflow template
|
||||
|
||||
{% data variables.product.prodname_dotcom %} provides a .NET workflow template that should work for most .NET projects, and this guide includes examples that show you how to customize this template. For more information, see the [.NET workflow template](https://github.com/actions/setup-dotnet).
|
||||
|
||||
To get started quickly, add the template to the `.github/workflows` directory of your repository.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: dotnet package
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
dotnet-version: [ '2.2.103', '3.0', '3.1.x' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup .NET Core SDK ${{ matrix.dotnet }}
|
||||
uses: actions/setup-dotnet@v1.6.0
|
||||
with:
|
||||
dotnet-version: {{ matrix.dotnet-version }}
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
- name: Test
|
||||
run: dotnet test --no-restore --verbosity normal
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### Specifying a .NET version
|
||||
|
||||
To use a preinstalled version of the .NET Core SDK on a {% data variables.product.prodname_dotcom %}-hosted runner, use the `setup-dotnet` action. This action finds a specific version of .NET from the tools cache on each runner, and adds the necessary binaries to `PATH`. These changes will persist for the remainder of the job.
|
||||
|
||||
The `setup-dotnet` action is the recommended way of using .NET with {% data variables.product.prodname_actions %}, because it ensures consistent behavior across different runners and different versions of .NET. If you are using a self-hosted runner, you must install .NET and add it to `PATH`. For more information, see the [`setup-dotnet`](https://github.com/marketplace/actions/setup-dotnet).
|
||||
|
||||
#### Using multiple .NET versions
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: dotnet package
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
dotnet: [ '2.2.103', '3.0', '3.1.x' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup dotnet ${{ matrix.dotnet-version }}
|
||||
uses: actions/setup-dotnet@v1.6.0
|
||||
with:
|
||||
dotnet-version: ${{ matrix.dotnet-version }}
|
||||
# You can test your matrix by printing the current dotnet version
|
||||
- name: Display dotnet version
|
||||
run: dotnet --version
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
#### Using a specific .NET version
|
||||
|
||||
You can configure your job to use a specific version of .NET, such as `3.1.3`. Alternatively, you can use semantic version syntax to get the latest minor release. This example uses the latest minor release of .NET 3.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
- name: Setup .NET 3.x
|
||||
uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
# Semantic version range syntax or exact version of a dotnet version
|
||||
dotnet-version: '3.x'
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### Installing dependencies
|
||||
|
||||
{% data variables.product.prodname_dotcom %}-hosted runners have the NuGet package manager installed. You can use the dotnet CLI to install dependencies from the NuGet package registry before building and testing your code. For example, the YAML below installs the `Newtonsoft` package.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1.6.0
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
- name: Install dependencies
|
||||
run: dotnet add package Newtonsoft.Json --version 12.0.1
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" %}
|
||||
|
||||
#### Caching dependencies
|
||||
|
||||
You can cache NuGet dependencies using a unique key, which allows you to restore the dependencies for future workflows with the [`cache`](https://github.com/marketplace/actions/cache) action. For example, the YAML below installs the `Newtonsoft` package.
|
||||
|
||||
For more information, see "[Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows)."
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1.6.0
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
# Look to see if there is a cache hit for the corresponding requirements file
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget
|
||||
- name: Install dependencies
|
||||
run: dotnet add package Newtonsoft.Json --version 12.0.1
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** Depending on the number of dependencies, it may be faster to use the dependency cache. Projects with many large dependencies should see a performance increase as it cuts down the time required for downloading. Projects with fewer dependencies may not see a significant performance increase and may even see a slight decrease due to how NuGet installs cached dependencies. The performance varies from project to project.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
### Building and testing your code
|
||||
|
||||
You can use the same commands that you use locally to build and test your code. This example demonstrates how to use `dotnet build` and `dotnet test` in a job:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1.6.0
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
- name: Test with the dotnet CLI
|
||||
run: dotnet test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### Packaging workflow data as artifacts
|
||||
|
||||
After a workflow completes, you can upload the resulting artifacts for analysis. For example, you may need to save log files, core dumps, test results, or screenshots. The following example demonstrates how you can use the `upload-artifact` action to upload test results.
|
||||
|
||||
For more information, see "[Persisting workflow data using artifacts](/github/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts)."
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: dotnet package
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
dotnet-version: [ '2.2.103', '3.0', '3.1.x' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1.6.0
|
||||
with:
|
||||
dotnet-version: ${{ matrix.dotnet-version }}
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Test with dotnet
|
||||
run: dotnet test --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
|
||||
- name: Upload dotnet test results
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: dotnet-results-${{ matrix.dotnet-version }}
|
||||
path: TestResults-${{ matrix.dotnet-version }}
|
||||
# Use always() to always run this step to publish test results when there are test failures
|
||||
if: ${{ always() }}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### Publishing to package registries
|
||||
|
||||
You can configure your workflow to publish your Dotnet package to a package registry when your CI tests pass. You can use repository secrets to store any tokens or credentials needed to publish your binary. The following example creates and publishes a package to {% data variables.product.prodname_registry %} using `dotnet core cli`.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Upload dotnet package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '3.1.x' # SDK Version to use.
|
||||
source-url: https://nuget.pkg.github.com/<owner>/index.json
|
||||
env:
|
||||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
- run: dotnet build <my project>
|
||||
- name: Create the package
|
||||
run: dotnet pack --configuration Release <my project>
|
||||
- name: Publish the package to GPR
|
||||
run: dotnet nuget push <my project>/bin/Release/*.nupkg
|
||||
```
|
||||
{% endraw %}
|
|
@ -37,7 +37,11 @@ To get started quickly, add the template to the `.github/workflows` directory of
|
|||
```yaml{:copy}
|
||||
name: Node.js CI
|
||||
|
||||
on: [push]
|
||||
on:
|
||||
push:
|
||||
branches: [ $default-branch ]
|
||||
pull_request:
|
||||
branches: [ $default-branch ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -46,7 +50,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [8.x, 10.x, 12.x]
|
||||
node-version: [10.x, 12.x, 14.x, 15.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -54,11 +58,9 @@ jobs:
|
|||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm install
|
||||
- run: npm ci
|
||||
- run: npm run build --if-present
|
||||
- run: npm test
|
||||
env:
|
||||
CI: true
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
|
@ -70,7 +72,7 @@ The easiest way to specify a Node.js version is by using the `setup-node` action
|
|||
|
||||
The `setup-node` action takes a Node.js version as an input and configures that version on the runner. The `setup-node` action finds a specific version of Node.js from the tools cache on each runner and adds the necessary binaries to `PATH`, which persists for the rest of the job. Using the `setup-node` action is the recommended way of using Node.js with {% data variables.product.prodname_actions %} because it ensures consistent behavior across different runners and different versions of Node.js. If you are using a self-hosted runner, you must install Node.js and add it to `PATH`.
|
||||
|
||||
The template includes a matrix strategy that builds and tests your code with three Node.js versions: 8.x, 10.x, and 12.x. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. Each version of Node.js specified in the `node-version` array creates a job that runs the same steps.
|
||||
The template includes a matrix strategy that builds and tests your code with four Node.js versions: 10.x, 12.x, 14.x, and 15.x. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. Each version of Node.js specified in the `node-version` array creates a job that runs the same steps.
|
||||
|
||||
Each job can access the value defined in the matrix `node-version` array using the `matrix` context. The `setup-node` action uses the context as the `node-version` input. The `setup-node` action configures each job with a different Node.js version before building and testing code. For more information about matrix strategies and contexts, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)" and "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
|
||||
|
||||
|
@ -78,7 +80,7 @@ Each job can access the value defined in the matrix `node-version` array using t
|
|||
```yaml
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [8.x, 10.x, 12.x]
|
||||
node-version: [10.x, 12.x, 14.x, 15.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -116,11 +118,9 @@ jobs:
|
|||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- run: npm install
|
||||
- run: npm ci
|
||||
- run: npm run build --if-present
|
||||
- run: npm test
|
||||
env:
|
||||
CI: true
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
|
@ -220,7 +220,7 @@ steps:
|
|||
|
||||
The example above creates an *.npmrc* file with the following contents:
|
||||
|
||||
```
|
||||
```ini
|
||||
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
|
||||
@octocat:registry=https://registry.npmjs.org/
|
||||
always-auth=true
|
||||
|
|
|
@ -123,7 +123,7 @@ jobs:
|
|||
|
||||
#### Using a specific Python version
|
||||
|
||||
You can configure a specific version of python. For example, 3.8. Alternatively, you can semantic version syntax to get the latest minor release. This example uses the latest minor release of Python 3.
|
||||
You can configure a specific version of python. For example, 3.8. Alternatively, you can use semantic version syntax to get the latest minor release. This example uses the latest minor release of Python 3.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
|
|
|
@ -124,14 +124,14 @@ A cache key can include any of the contexts, functions, literals, and operators
|
|||
Using expressions to create a `key` allows you to automatically create a new cache when dependencies have changed. For example, you can create a `key` using an expression that calculates the hash of an npm `package-lock.json` file.
|
||||
|
||||
{% raw %}
|
||||
```
|
||||
```yaml
|
||||
npm-${{ hashFiles('package-lock.json') }}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% data variables.product.prodname_dotcom %} evaluates the expression `hash "package-lock.json"` to derive the final `key`.
|
||||
|
||||
```
|
||||
```yaml
|
||||
npm-d5ea0750
|
||||
```
|
||||
|
||||
|
@ -144,7 +144,7 @@ You can provide a list of restore keys to use when there is a cache miss on `key
|
|||
#### Example using multiple restore keys
|
||||
|
||||
{% raw %}
|
||||
```
|
||||
```yaml
|
||||
restore-keys: |
|
||||
npm-foobar-${{ hashFiles('package-lock.json') }}
|
||||
npm-foobar-
|
||||
|
@ -155,7 +155,7 @@ restore-keys: |
|
|||
The runner evaluates the expressions, which resolve to these `restore-keys`:
|
||||
|
||||
{% raw %}
|
||||
```
|
||||
```yaml
|
||||
restore-keys: |
|
||||
npm-foobar-d5ea0750
|
||||
npm-foobar-
|
||||
|
|
|
@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
|
|||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.22'
|
||||
type: 'tutorial'
|
||||
---
|
||||
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
|
|
|
@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
|
|||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.22'
|
||||
type: 'tutorial'
|
||||
---
|
||||
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
|
@ -54,7 +55,7 @@ Before creating your {% data variables.product.prodname_actions %} workflow, you
|
|||
|
||||
3. Configure an Azure publish profile and create an `AZURE_WEBAPP_PUBLISH_PROFILE` secret.
|
||||
|
||||
Generate your Azure deployment credentials using a publish profile. For more information, see "[Generate deployment credentials](https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials)" in the Azure documentation.
|
||||
Generate your Azure deployment credentials using a publish profile. For more information, see "[Generate deployment credentials](https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials)" in the Azure documentation.
|
||||
|
||||
In your {% data variables.product.prodname_dotcom %} repository, create a secret named `AZURE_WEBAPP_PUBLISH_PROFILE` that contains the contents of the publish profile. For more information on creating secrets, see "[Encrypted secrets](/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository)."
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
|
|||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.22'
|
||||
type: 'tutorial'
|
||||
---
|
||||
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
|
@ -99,37 +100,37 @@ The following example workflow demonstrates how to build a container image and p
|
|||
{% raw %}
|
||||
```yaml{:copy}
|
||||
name: Build and Deploy to GKE
|
||||
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
|
||||
env:
|
||||
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
|
||||
GKE_CLUSTER: cluster-1 # Add your cluster name here.
|
||||
GKE_ZONE: us-central1-c # Add your cluster zone here.
|
||||
DEPLOYMENT_NAME: gke-test # Add your deployment name here.
|
||||
IMAGE: static-site
|
||||
|
||||
|
||||
jobs:
|
||||
setup-build-publish-deploy:
|
||||
name: Setup, Build, Publish, and Deploy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
|
||||
# Setup gcloud CLI
|
||||
- uses: google-github-actions/setup-gcloud@v0.2.0
|
||||
with:
|
||||
service_account_key: ${{ secrets.GKE_SA_KEY }}
|
||||
project_id: ${{ secrets.GKE_PROJECT }}
|
||||
|
||||
|
||||
# Configure docker to use the gcloud command-line tool as a credential helper
|
||||
- run: |-
|
||||
gcloud --quiet auth configure-docker
|
||||
|
||||
|
||||
# Get the GKE credentials so we can deploy to the cluster
|
||||
- uses: google-github-actions/get-gke-credentials@v0.2.1
|
||||
with:
|
||||
|
@ -145,18 +146,18 @@ jobs:
|
|||
--build-arg GITHUB_SHA="$GITHUB_SHA" \
|
||||
--build-arg GITHUB_REF="$GITHUB_REF" \
|
||||
.
|
||||
|
||||
|
||||
# Push the Docker image to Google Container Registry
|
||||
- name: Publish
|
||||
run: |-
|
||||
docker push "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA"
|
||||
|
||||
|
||||
# Set up kustomize
|
||||
- name: Set up Kustomize
|
||||
run: |-
|
||||
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
|
||||
chmod u+x ./kustomize
|
||||
|
||||
|
||||
# Deploy the Docker image to the GKE cluster
|
||||
- name: Deploy
|
||||
run: |-
|
||||
|
|
|
@ -28,6 +28,7 @@ layout: product-sublanding
|
|||
<!-- {% link_in_list /about-continuous-integration %} -->
|
||||
<!-- {% link_in_list /setting-up-continuous-integration-using-workflow-templates %} -->
|
||||
<!-- {% link_in_list /building-and-testing-nodejs %} -->
|
||||
<!-- {% link_in_list /building-and-testing-net %} -->
|
||||
<!-- {% link_in_list /building-and-testing-powershell %} -->
|
||||
<!-- {% link_in_list /building-and-testing-python %} -->
|
||||
<!-- {% link_in_list /building-and-testing-ruby %} -->
|
||||
|
|
|
@ -78,7 +78,7 @@ jobs:
|
|||
|
||||
In the example above, the `setup-node` action creates an *.npmrc* file on the runner with the following contents:
|
||||
|
||||
```
|
||||
```ini
|
||||
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
|
||||
registry=https://registry.npmjs.org/
|
||||
always-auth=true
|
||||
|
@ -140,7 +140,7 @@ jobs:
|
|||
|
||||
The `setup-node` action creates an *.npmrc* file on the runner. When you use the `scope` input to the `setup-node` action, the *.npmrc* file includes the scope prefix. By default, the `setup-node` action sets the scope in the *.npmrc* file to the account that contains that workflow file.
|
||||
|
||||
```
|
||||
```ini
|
||||
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
|
||||
@octocat:registry=https://npm.pkg.github.com
|
||||
always-auth=true
|
||||
|
|
|
@ -114,7 +114,7 @@ jobs:
|
|||
|
||||
You can define a custom retention period for individual artifacts created by a workflow. When using a workflow to create a new artifact, you can use `retention-days` with the `upload-artifact` action. This example demonstrates how to set a custom retention period of 5 days for the artifact named `my-artifact`:
|
||||
|
||||
```
|
||||
```yaml
|
||||
- name: 'Upload Artifact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
|
|
@ -13,6 +13,10 @@ type: 'tutorial'
|
|||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
You can add a self-hosted runner to a repository, an organization, or an enterprise.
|
||||
|
||||
If you are an organization or enterprise administrator, you might want to add your self-hosted runners at the organization or enterprise level. This approach makes the runner available to multiple repositories in your organization or enterprise, and also lets you to manage your runners in one place.
|
||||
|
||||
For information on supported operating systems for self-hosted runners, or using self-hosted runners with a proxy server, see "[About self-hosted runners](/github/automating-your-workflow-with-github-actions/about-self-hosted-runners)."
|
||||
|
||||
{% warning %}
|
||||
|
@ -45,6 +49,8 @@ You can add self-hosted runners at the organization level, where they can be use
|
|||
{% data reusables.github-actions.self-hosted-runner-configure %}
|
||||
{% data reusables.github-actions.self-hosted-runner-check-installation-success %}
|
||||
|
||||
{% data reusables.github-actions.self-hosted-runner-public-repo-access %}
|
||||
|
||||
### Adding a self-hosted runner to an enterprise
|
||||
|
||||
You can add self-hosted runners to an enterprise, where they can be assigned to multiple organizations. The organization admins are then able to control which repositories can use it.
|
||||
|
@ -62,3 +68,13 @@ To add a self-hosted runner at the enterprise level of {% data variables.product
|
|||
1. Click **Add new**, then click **New runner**. New runners are assigned to the default group. You can modify the runner's group after you've registered the runner. For more information, see "[Managing access to self-hosted runners](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups#moving-a-self-hosted-runner-to-a-group)."
|
||||
{% data reusables.github-actions.self-hosted-runner-configure %}
|
||||
{% data reusables.github-actions.self-hosted-runner-check-installation-success %}
|
||||
|
||||
{% data reusables.github-actions.self-hosted-runner-public-repo-access %}
|
||||
|
||||
#### Making enterprise runners available to repositories
|
||||
|
||||
By default, runners in an enterprise's "Default" self-hosted runner group are available to all organizations in the enterprise, but are not available to all repositories in each organization.
|
||||
|
||||
To make an enterprise-level self-hosted runner group available to an organization repository, you might need to change the organization's inherited settings for the runner group to make the runner available to repositories in the organization.
|
||||
|
||||
For more information on changing runner group access settings, see "[Managing access to self-hosted runners using groups](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups#changing-the-access-policy-of-a-self-hosted-runner-group)."
|
||||
|
|
|
@ -38,7 +38,7 @@ If setting environment variables is not practical, you can set the proxy configu
|
|||
|
||||
An example _.env_ proxy configuration is shown below:
|
||||
|
||||
```
|
||||
```ini
|
||||
https_proxy=http://proxy.local:8080
|
||||
no_proxy=example.com,myserver.local:443
|
||||
```
|
||||
|
|
|
@ -36,7 +36,7 @@ changelog:
|
|||
href: https://github.blog/changelog/2020-10-29-github-actions-ubuntu-latest-workflows-will-use-ubuntu-20-04
|
||||
|
||||
product_video: https://www.youtube-nocookie.com/embed/cP0I9w2coGU
|
||||
|
||||
|
||||
redirect_from:
|
||||
- /articles/automating-your-workflow-with-github-actions/
|
||||
- /articles/customizing-your-project-with-github-actions/
|
||||
|
@ -72,7 +72,7 @@ versions:
|
|||
{% render 'code-example-card' for actionsCodeExamples as example %}
|
||||
</div>
|
||||
|
||||
<button class="js-filter-card-show-more btn btn-outline float-right">Show more {% octicon "arrow-right" %}</button>
|
||||
<button class="js-filter-card-show-more btn btn-outline float-right" data-js-filter-card-max="6">Show more {% octicon "arrow-right" %}</button>
|
||||
|
||||
<div class="js-filter-card-no-results d-none py-4 text-center text-gray font-mktg">
|
||||
<div class="mb-3">{% octicon "search" width="24" %}</div>
|
||||
|
|
|
@ -147,7 +147,7 @@ To help you understand how YAML syntax is used to create a workflow file, this s
|
|||
```
|
||||
</td>
|
||||
<td>
|
||||
Groups together all the steps that run in the <code>check-bats-version</code> job. Each line nested under this section is a separate action.
|
||||
Groups together all the steps that run in the <code>check-bats-version</code> job. Each item nested under this section is a separate action or shell command.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -62,16 +62,16 @@ Azure Pipelines
|
|||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
- job: scripts
|
||||
pool:
|
||||
vmImage: 'windows-latest'
|
||||
steps:
|
||||
- script: echo "This step runs in the default shell"
|
||||
- bash: echo "This step runs in bash"
|
||||
- pwsh: Write-Host "This step runs in PowerShell Core"
|
||||
- task: PowerShell@2
|
||||
inputs:
|
||||
script: Write-Host "This step runs in PowerShell"
|
||||
- job: scripts
|
||||
pool:
|
||||
vmImage: 'windows-latest'
|
||||
steps:
|
||||
- script: echo "This step runs in the default shell"
|
||||
- bash: echo "This step runs in bash"
|
||||
- pwsh: Write-Host "This step runs in PowerShell Core"
|
||||
- task: PowerShell@2
|
||||
inputs:
|
||||
script: Write-Host "This step runs in PowerShell"
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -82,13 +82,13 @@ jobs:
|
|||
scripts:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- run: echo "This step runs in the default shell"
|
||||
- run: echo "This step runs in bash"
|
||||
shell: bash
|
||||
- run: Write-Host "This step runs in PowerShell Core"
|
||||
shell: pwsh
|
||||
- run: Write-Host "This step runs in PowerShell"
|
||||
shell: powershell
|
||||
- run: echo "This step runs in the default shell"
|
||||
- run: echo "This step runs in bash"
|
||||
shell: bash
|
||||
- run: Write-Host "This step runs in PowerShell Core"
|
||||
shell: pwsh
|
||||
- run: Write-Host "This step runs in PowerShell"
|
||||
shell: powershell
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -123,11 +123,11 @@ Azure Pipelines
|
|||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
- job: run_command
|
||||
pool:
|
||||
vmImage: 'windows-latest'
|
||||
steps:
|
||||
- script: echo "This step runs in CMD on Windows by default"
|
||||
- job: run_command
|
||||
pool:
|
||||
vmImage: 'windows-latest'
|
||||
steps:
|
||||
- script: echo "This step runs in CMD on Windows by default"
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -138,9 +138,9 @@ jobs:
|
|||
run_command:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- run: echo "This step runs in PowerShell on Windows by default"
|
||||
- run: echo "This step runs in CMD on Windows explicitly"
|
||||
shell: cmd
|
||||
- run: echo "This step runs in PowerShell on Windows by default"
|
||||
- run: echo "This step runs in CMD on Windows explicitly"
|
||||
shell: cmd
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -171,12 +171,12 @@ Azure Pipelines
|
|||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
- job: conditional
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
steps:
|
||||
- script: echo "This step runs with str equals 'ABC' and num equals 123"
|
||||
condition: and(eq(variables.str, 'ABC'), eq(variables.num, 123))
|
||||
- job: conditional
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
steps:
|
||||
- script: echo "This step runs with str equals 'ABC' and num equals 123"
|
||||
condition: and(eq(variables.str, 'ABC'), eq(variables.num, 123))
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -187,8 +187,8 @@ jobs:
|
|||
conditional:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "This step runs with str equals 'ABC' and num equals 123"
|
||||
if: ${{ env.str == 'ABC' && env.num == 123 }}
|
||||
- run: echo "This step runs with str equals 'ABC' and num equals 123"
|
||||
if: ${{ env.str == 'ABC' && env.num == 123 }}
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -217,29 +217,29 @@ Azure Pipelines
|
|||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
- job: initial
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
steps:
|
||||
- script: echo "This job will be run first."
|
||||
- job: fanout1
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
dependsOn: initial
|
||||
steps:
|
||||
- script: echo "This job will run after the initial job, in parallel with fanout2."
|
||||
- job: fanout2
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
dependsOn: initial
|
||||
steps:
|
||||
- script: echo "This job will run after the initial job, in parallel with fanout1."
|
||||
- job: fanin:
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
dependsOn: [fanout1, fanout2]
|
||||
steps:
|
||||
- script: echo "This job will run after fanout1 and fanout2 have finished."
|
||||
- job: initial
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
steps:
|
||||
- script: echo "This job will be run first."
|
||||
- job: fanout1
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
dependsOn: initial
|
||||
steps:
|
||||
- script: echo "This job will run after the initial job, in parallel with fanout2."
|
||||
- job: fanout2
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
dependsOn: initial
|
||||
steps:
|
||||
- script: echo "This job will run after the initial job, in parallel with fanout1."
|
||||
- job: fanin:
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
dependsOn: [fanout1, fanout2]
|
||||
steps:
|
||||
- script: echo "This job will run after fanout1 and fanout2 have finished."
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -250,22 +250,22 @@ jobs:
|
|||
initial:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "This job will be run first."
|
||||
- run: echo "This job will be run first."
|
||||
fanout1:
|
||||
runs-on: ubuntu-latest
|
||||
needs: initial
|
||||
steps:
|
||||
- run: echo "This job will run after the initial job, in parallel with fanout2."
|
||||
- run: echo "This job will run after the initial job, in parallel with fanout2."
|
||||
fanout2:
|
||||
runs-on: ubuntu-latest
|
||||
needs: initial
|
||||
steps:
|
||||
- run: echo "This job will run after the initial job, in parallel with fanout1."
|
||||
- run: echo "This job will run after the initial job, in parallel with fanout1."
|
||||
fanin:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [fanout1, fanout2]
|
||||
steps:
|
||||
- run: echo "This job will run after fanout1 and fanout2 have finished."
|
||||
- run: echo "This job will run after fanout1 and fanout2 have finished."
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -294,15 +294,15 @@ Azure Pipelines
|
|||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
- job: run_python
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.7'
|
||||
architecture: 'x64'
|
||||
- script: python script.py
|
||||
- job: run_python
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.7'
|
||||
architecture: 'x64'
|
||||
- script: python script.py
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -313,11 +313,11 @@ jobs:
|
|||
run_python:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
architecture: 'x64'
|
||||
- run: python script.py
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
architecture: 'x64'
|
||||
- run: python script.py
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
|
|
@ -258,24 +258,24 @@ jobs:
|
|||
POSTGRES_DB: ruby25
|
||||
POSTGRES_PASSWORD: ""
|
||||
ports:
|
||||
- 5432:5432
|
||||
- 5432:5432
|
||||
# Add a health check
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
|
||||
steps:
|
||||
# This Docker file changes sets USER to circleci instead of using the default user, so we need to update file permissions for this image to work on GH Actions.
|
||||
# See https://docs.github.com/actions/reference/virtual-environments-for-github-hosted-runners#docker-container-filesystem
|
||||
- name: Setup file system permissions
|
||||
run: sudo chmod -R 777 $GITHUB_WORKSPACE /github /__w/_temp
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: bundle install --path vendor/bundle
|
||||
- name: Setup environment configuration
|
||||
run: cp .sample.env .env
|
||||
- name: Setup database
|
||||
run: bundle exec rake db:setup
|
||||
- name: Run tests
|
||||
run: bundle exec rake
|
||||
# This Docker file changes sets USER to circleci instead of using the default user, so we need to update file permissions for this image to work on GH Actions.
|
||||
# See https://docs.github.com/actions/reference/virtual-environments-for-github-hosted-runners#docker-container-filesystem
|
||||
- name: Setup file system permissions
|
||||
run: sudo chmod -R 777 $GITHUB_WORKSPACE /github /__w/_temp
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: bundle install --path vendor/bundle
|
||||
- name: Setup environment configuration
|
||||
run: cp .sample.env .env
|
||||
- name: Setup database
|
||||
run: bundle exec rake db:setup
|
||||
- name: Run tests
|
||||
run: bundle exec rake
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -412,35 +412,35 @@ jobs:
|
|||
POSTGRES_DB: ruby25
|
||||
POSTGRES_PASSWORD: ""
|
||||
ports:
|
||||
- 5432:5432
|
||||
- 5432:5432
|
||||
# Add a health check
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Ruby
|
||||
uses: eregon/use-ruby-action@master
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: administrate-${{ matrix.image }}-${{ hashFiles('Gemfile.lock') }}
|
||||
- name: Install postgres headers
|
||||
run: sudo apt-get install libpq-dev
|
||||
- name: Install dependencies
|
||||
run: bundle install --path vendor/bundle
|
||||
- name: Setup environment configuration
|
||||
run: cp .sample.env .env
|
||||
- name: Setup database
|
||||
run: bundle exec rake db:setup
|
||||
- name: Run tests
|
||||
run: bundle exec rake
|
||||
- name: Install appraisal
|
||||
run: bundle exec appraisal install
|
||||
- name: Run appraisal
|
||||
run: bundle exec appraisal rake
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Ruby
|
||||
uses: eregon/use-ruby-action@master
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: administrate-${{ matrix.image }}-${{ hashFiles('Gemfile.lock') }}
|
||||
- name: Install postgres headers
|
||||
run: sudo apt-get install libpq-dev
|
||||
- name: Install dependencies
|
||||
run: bundle install --path vendor/bundle
|
||||
- name: Setup environment configuration
|
||||
run: cp .sample.env .env
|
||||
- name: Setup database
|
||||
run: bundle exec rake db:setup
|
||||
- name: Run tests
|
||||
run: bundle exec rake
|
||||
- name: Install appraisal
|
||||
run: bundle exec appraisal install
|
||||
- name: Run appraisal
|
||||
run: bundle exec appraisal rake
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
|
|
@ -60,8 +60,8 @@ job1:
|
|||
jobs:
|
||||
job1:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: echo "Run your script here"
|
||||
- uses: actions/checkout@v2
|
||||
- run: echo "Run your script here"
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -257,24 +257,24 @@ jobs:
|
|||
build_a:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "This job will be run first."
|
||||
- run: echo "This job will be run first."
|
||||
|
||||
build_b:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "This job will be run first, in parallel with build_a"
|
||||
- run: echo "This job will be run first, in parallel with build_a"
|
||||
|
||||
test_ab:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build_a,build_b]
|
||||
steps:
|
||||
- run: echo "This job will run after build_a and build_b have finished"
|
||||
- run: echo "This job will run after build_a and build_b have finished"
|
||||
|
||||
deploy_ab:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test_ab]
|
||||
steps:
|
||||
- run: echo "This job will run after test_ab is complete"
|
||||
- run: echo "This job will run after test_ab is complete"
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -335,12 +335,12 @@ test_async:
|
|||
```yaml
|
||||
jobs:
|
||||
test_async:
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: v1-npm-deps-
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: v1-npm-deps-
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -371,7 +371,7 @@ GitLab CI/CD
|
|||
script:
|
||||
artifacts:
|
||||
paths:
|
||||
- math-homework.txt
|
||||
- math-homework.txt
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -424,12 +424,12 @@ container-job:
|
|||
services:
|
||||
- postgres
|
||||
script:
|
||||
# Performs a clean installation of all dependencies
|
||||
# in the `package.json` file
|
||||
- npm ci
|
||||
# Runs a script that creates a PostgreSQL client,
|
||||
# populates the client with data, and retrieves data
|
||||
- node client.js
|
||||
# Performs a clean installation of all dependencies
|
||||
# in the `package.json` file
|
||||
- npm ci
|
||||
# Runs a script that creates a PostgreSQL client,
|
||||
# populates the client with data, and retrieves data
|
||||
- node client.js
|
||||
tags:
|
||||
- docker
|
||||
```
|
||||
|
|
|
@ -36,21 +36,20 @@ Jenkins lets you send builds to a single build agent, or you can distribute them
|
|||
|
||||
Similarly, {% data variables.product.prodname_actions %} can send jobs to {% data variables.product.prodname_dotcom %}-hosted or self-hosted runners, and you can use labels to classify runners according to various attributes. The following table compares how the distributed build concept is implemented for both Jenkins and {% data variables.product.prodname_actions %}.
|
||||
|
||||
| Jenkins | {% data variables.product.prodname_actions %} |
|
||||
| Jenkins | {% data variables.product.prodname_actions %} |
|
||||
| ------------- | ------------- |
|
||||
| [`agents`](https://wiki.jenkins.io/display/JENKINS/Distributed+builds) | [`runners`](/actions/learn-github-actions/introduction-to-github-actions#runners) <br> [`self-hosted runners`](/actions/hosting-your-own-runners/about-self-hosted-runners)|
|
||||
| [`agents`](https://wiki.jenkins.io/display/JENKINS/Distributed+builds) | [`runners`](/actions/learn-github-actions/introduction-to-github-actions#runners) <br> [`self-hosted runners`](/actions/hosting-your-own-runners/about-self-hosted-runners) |
|
||||
|
||||
#### Using sections to organize pipelines
|
||||
|
||||
Jenkins splits its Declarative Pipelines into multiple sections. Similarly, {% data variables.product.prodname_actions %} organizes its workflows into separate sections. The table below compares Jenkins sections with the {% data variables.product.prodname_actions %} workflow.
|
||||
|
||||
|Jenkins Directives | {% data variables.product.prodname_actions %} |
|
||||
| Jenkins Directives | {% data variables.product.prodname_actions %} |
|
||||
| ------------- | ------------- |
|
||||
| [`agent`](https://jenkins.io/doc/book/pipeline/syntax/#agent) | [`jobs.<job_id>.runs-on`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idruns-on) <br> [`jobs.<job_id>.container`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontainer)|
|
||||
| [`post`](https://jenkins.io/doc/book/pipeline/syntax/#post) | |
|
||||
| [`stages`](https://jenkins.io/doc/book/pipeline/syntax/#stages) | [`jobs`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobs) |
|
||||
| [`steps`](https://jenkins.io/doc/book/pipeline/syntax/#steps) | [`jobs.<job_id>.steps`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps) |
|
||||
|
||||
| [`agent`](https://jenkins.io/doc/book/pipeline/syntax/#agent) | [`jobs.<job_id>.runs-on`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idruns-on) <br> [`jobs.<job_id>.container`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontainer) |
|
||||
| [`post`](https://jenkins.io/doc/book/pipeline/syntax/#post) | |
|
||||
| [`stages`](https://jenkins.io/doc/book/pipeline/syntax/#stages) | [`jobs`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobs) |
|
||||
| [`steps`](https://jenkins.io/doc/book/pipeline/syntax/#steps) | [`jobs.<job_id>.steps`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps) |
|
||||
|
||||
### Using directives
|
||||
|
||||
|
@ -58,17 +57,16 @@ Jenkins uses directives to manage _Declarative Pipelines_. These directives defi
|
|||
|
||||
| Jenkins Directives | {% data variables.product.prodname_actions %} |
|
||||
| ------------- | ------------- |
|
||||
| [`environment`](https://jenkins.io/doc/book/pipeline/syntax/#environment) | [`jobs.<job_id>.env`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#env) <br> [`jobs.<job_id>.steps[*].env`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsenv) |
|
||||
| [`options`](https://jenkins.io/doc/book/pipeline/syntax/#parameters) | [`jobs.<job_id>.strategy`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategy) <br> [`jobs.<job_id>.strategy.fail-fast`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast) <br> [`jobs.<job_id>.timeout-minutes`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes)|
|
||||
| [`parameters`](https://jenkins.io/doc/book/pipeline/syntax/#parameters) | [`inputs`](/actions/creating-actions/metadata-syntax-for-github-actions#inputs) <br> [`outputs`](/actions/creating-actions/metadata-syntax-for-github-actions#outputs) |
|
||||
| [`triggers`](https://jenkins.io/doc/book/pipeline/syntax/#triggers) | [`on`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#on) <br> [`on.<event_name>.types`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onevent_nametypes) <br> [<code>on.<push\|pull_request>.<branches\|tags></code>](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestbranchestags) <br> [<code>on.<push\|pull_request>.paths</code>](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestpaths) |
|
||||
| [`triggers { upstreamprojects() }`](https://jenkins.io/doc/book/pipeline/syntax/#triggers) | [`jobs.<job_id>.needs`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idneeds) |
|
||||
| [Jenkins cron syntax](https://jenkins.io/doc/book/pipeline/syntax/#cron-syntax) | [`on.schedule`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onschedule) |
|
||||
| [`stage`](https://jenkins.io/doc/book/pipeline/syntax/#stage) | [`jobs.<job_id>`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_id) <br> [`jobs.<job_id>.name`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idname)|
|
||||
| [`tools`](https://jenkins.io/doc/book/pipeline/syntax/#tools) | [Specifications for {% data variables.product.prodname_dotcom %}-hosted runners](/actions/reference/specifications-for-github-hosted-runners/#supported-software) |
|
||||
| [`input`](https://jenkins.io/doc/book/pipeline/syntax/#input) | [`inputs`](/actions/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputs) |
|
||||
| [`when`](https://jenkins.io/doc/book/pipeline/syntax/#when) | [`jobs.<job_id>.if`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idif) |
|
||||
|
||||
| [`environment`](https://jenkins.io/doc/book/pipeline/syntax/#environment) | [`jobs.<job_id>.env`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#env) <br> [`jobs.<job_id>.steps[*].env`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsenv) |
|
||||
| [`options`](https://jenkins.io/doc/book/pipeline/syntax/#parameters) | [`jobs.<job_id>.strategy`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategy) <br> [`jobs.<job_id>.strategy.fail-fast`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast) <br> [`jobs.<job_id>.timeout-minutes`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes) |
|
||||
| [`parameters`](https://jenkins.io/doc/book/pipeline/syntax/#parameters) | [`inputs`](/actions/creating-actions/metadata-syntax-for-github-actions#inputs) <br> [`outputs`](/actions/creating-actions/metadata-syntax-for-github-actions#outputs) |
|
||||
| [`triggers`](https://jenkins.io/doc/book/pipeline/syntax/#triggers) | [`on`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#on) <br> [`on.<event_name>.types`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onevent_nametypes) <br> [<code>on.<push\|pull_request>.<branches\|tags></code>](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestbranchestags) <br> [<code>on.<push\|pull_request>.paths</code>](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestpaths) |
|
||||
| [`triggers { upstreamprojects() }`](https://jenkins.io/doc/book/pipeline/syntax/#triggers) | [`jobs.<job_id>.needs`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idneeds) |
|
||||
| [Jenkins cron syntax](https://jenkins.io/doc/book/pipeline/syntax/#cron-syntax) | [`on.schedule`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onschedule) |
|
||||
| [`stage`](https://jenkins.io/doc/book/pipeline/syntax/#stage) | [`jobs.<job_id>`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_id) <br> [`jobs.<job_id>.name`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idname) |
|
||||
| [`tools`](https://jenkins.io/doc/book/pipeline/syntax/#tools) | [Specifications for {% data variables.product.prodname_dotcom %}-hosted runners](/actions/reference/specifications-for-github-hosted-runners/#supported-software) |
|
||||
| [`input`](https://jenkins.io/doc/book/pipeline/syntax/#input) | [`inputs`](/actions/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputs) |
|
||||
| [`when`](https://jenkins.io/doc/book/pipeline/syntax/#when) | [`jobs.<job_id>.if`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idif) |
|
||||
|
||||
### Using sequential stages
|
||||
|
||||
|
@ -84,19 +82,19 @@ Jenkins can run the `stages` and `steps` in parallel, while {% data variables.pr
|
|||
|
||||
Both {% data variables.product.prodname_actions %} and Jenkins let you use a build matrix to define various system combinations.
|
||||
|
||||
| Jenkins | {% data variables.product.prodname_actions %} |
|
||||
| Jenkins | {% data variables.product.prodname_actions %} |
|
||||
| ------------- | ------------- |
|
||||
| [`axis`](https://jenkins.io/doc/book/pipeline/syntax/#matrix-axes) | [`strategy/matrix`](/actions/learn-github-actions/managing-complex-workflows/#using-a-build-matrix) <br> [`context`](/actions/reference/context-and-expression-syntax-for-github-actions) |
|
||||
| [`stages`](https://jenkins.io/doc/book/pipeline/syntax/#matrix-stages) | [`steps-context`](/actions/reference/context-and-expression-syntax-for-github-actions#steps-context) |
|
||||
| [`excludes`](https://jenkins.io/doc/book/pipeline/syntax/#matrix-stages) | |
|
||||
| [`axis`](https://jenkins.io/doc/book/pipeline/syntax/#matrix-axes) | [`strategy/matrix`](/actions/learn-github-actions/managing-complex-workflows/#using-a-build-matrix) <br> [`context`](/actions/reference/context-and-expression-syntax-for-github-actions) |
|
||||
| [`stages`](https://jenkins.io/doc/book/pipeline/syntax/#matrix-stages) | [`steps-context`](/actions/reference/context-and-expression-syntax-for-github-actions#steps-context) |
|
||||
| [`excludes`](https://jenkins.io/doc/book/pipeline/syntax/#matrix-stages) | |
|
||||
|
||||
#### Using steps to execute tasks
|
||||
|
||||
Jenkins groups `steps` together in `stages`. Each of these steps can be a script, function, or command, among others. Similarly, {% data variables.product.prodname_actions %} uses `jobs` to execute specific groups of `steps`.
|
||||
|
||||
| Jenkins steps | {% data variables.product.prodname_actions %} |
|
||||
| Jenkins steps | {% data variables.product.prodname_actions %} |
|
||||
| ------------- | ------------- |
|
||||
| [`script`](https://jenkins.io/doc/book/pipeline/syntax/#script) | [`jobs.<job_id>.steps`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps) |
|
||||
| [`script`](https://jenkins.io/doc/book/pipeline/syntax/#script) | [`jobs.<job_id>.steps`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps) |
|
||||
|
||||
### Examples of common tasks
|
||||
|
||||
|
@ -114,23 +112,23 @@ Jenkins Pipeline
|
|||
<tr>
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
pipeline {
|
||||
agent any
|
||||
triggers {
|
||||
cron('H/15 * * * 1-5')
|
||||
}
|
||||
}
|
||||
```
|
||||
```yaml
|
||||
pipeline {
|
||||
agent any
|
||||
triggers {
|
||||
cron('H/15 * * * 1-5')
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
on:
|
||||
```yaml
|
||||
on:
|
||||
schedule:
|
||||
- cron: '*/15 * * * 1-5'
|
||||
```
|
||||
- cron: '*/15 * * * 1-5'
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -150,25 +148,24 @@ Jenkins Pipeline
|
|||
<tr>
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
pipeline {
|
||||
agent any
|
||||
environment {
|
||||
MAVEN_PATH = '/usr/local/maven'
|
||||
}
|
||||
```yaml
|
||||
pipeline {
|
||||
agent any
|
||||
environment {
|
||||
MAVEN_PATH = '/usr/local/maven'
|
||||
}
|
||||
```
|
||||
}
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
maven-build:
|
||||
```yaml
|
||||
jobs:
|
||||
maven-build:
|
||||
env:
|
||||
MAVEN_PATH: '/usr/local/maven'
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -188,30 +185,28 @@ Jenkins Pipeline
|
|||
<tr>
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
pipeline {
|
||||
triggers {
|
||||
upstream(
|
||||
upstreamProjects: 'job1,job2',
|
||||
threshold: hudson.model.Result.SUCCESS)
|
||||
}
|
||||
}
|
||||
```yaml
|
||||
pipeline {
|
||||
triggers {
|
||||
upstream(
|
||||
upstreamProjects: 'job1,job2',
|
||||
threshold: hudson.model.Result.SUCCESS
|
||||
)
|
||||
}
|
||||
|
||||
```
|
||||
}
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
job1:
|
||||
job2:
|
||||
needs: job1
|
||||
job3:
|
||||
needs: [job1, job2]
|
||||
|
||||
```
|
||||
```yaml
|
||||
jobs:
|
||||
job1:
|
||||
job2:
|
||||
needs: job1
|
||||
job3:
|
||||
needs: [job1, job2]
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -231,26 +226,27 @@ Jenkins Pipeline
|
|||
<tr>
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
```yaml
|
||||
pipeline {
|
||||
agent none
|
||||
stages {
|
||||
stage('Run Tests') {
|
||||
matrix {
|
||||
axes {
|
||||
axis {
|
||||
name: 'PLATFORM'
|
||||
values: 'macos', 'linux'
|
||||
agent none
|
||||
stages {
|
||||
stage('Run Tests') {
|
||||
matrix {
|
||||
axes {
|
||||
axis {
|
||||
name: 'PLATFORM'
|
||||
values: 'macos', 'linux'
|
||||
}
|
||||
}
|
||||
}
|
||||
agent { label "${PLATFORM}" }
|
||||
stages {
|
||||
stage('test') {
|
||||
tools { nodejs "node-12" }
|
||||
steps {
|
||||
dir("scripts/myapp") {
|
||||
sh(script: "npm install -g bats")
|
||||
sh(script: "bats tests")
|
||||
agent { label "${PLATFORM}" }
|
||||
stages {
|
||||
stage('test') {
|
||||
tools { nodejs "node-12" }
|
||||
steps {
|
||||
dir("scripts/myapp") {
|
||||
sh(script: "npm install -g bats")
|
||||
sh(script: "bats tests")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -258,33 +254,32 @@ stages {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: demo-workflow
|
||||
on:
|
||||
push:
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
- run: npm install -g bats
|
||||
- run: bats tests
|
||||
working-directory: scripts/myapp
|
||||
```
|
||||
```yaml
|
||||
name: demo-workflow
|
||||
on:
|
||||
push:
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
- run: npm install -g bats
|
||||
- run: bats tests
|
||||
working-directory: scripts/myapp
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
</td>
|
||||
|
|
|
@ -70,8 +70,8 @@ Travis CI
|
|||
```yaml
|
||||
matrix:
|
||||
include:
|
||||
- rvm: 2.5
|
||||
- rvm: 2.6.3
|
||||
- rvm: 2.5
|
||||
- rvm: 2.6.3
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -110,8 +110,8 @@ Travis CI
|
|||
```yaml
|
||||
branches:
|
||||
only:
|
||||
- main
|
||||
- 'mona/octocat'
|
||||
- main
|
||||
- 'mona/octocat'
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -120,7 +120,7 @@ branches:
|
|||
```yaml
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
branches:
|
||||
- main
|
||||
- 'mona/octocat'
|
||||
```
|
||||
|
@ -156,9 +156,9 @@ git:
|
|||
<td class="d-table-cell v-align-top">
|
||||
{% raw %}
|
||||
```yaml
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: false
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: false
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -208,10 +208,10 @@ When working with different languages in {% data variables.product.prodname_acti
|
|||
For example:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- name: Run build script
|
||||
run: ./.github/scripts/build.sh
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Run build script
|
||||
run: ./.github/scripts/build.sh
|
||||
shell: bash
|
||||
```
|
||||
|
||||
### Error handling in {% data variables.product.prodname_actions %}
|
||||
|
@ -276,11 +276,11 @@ jobs:
|
|||
run_python:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
architecture: 'x64'
|
||||
- run: python script.py
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
architecture: 'x64'
|
||||
- run: python script.py
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
|
@ -346,20 +346,20 @@ Travis CI
|
|||
<tr>
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
```yaml
|
||||
env:
|
||||
- MAVEN_PATH="/usr/local/maven"
|
||||
```
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
maven-build:
|
||||
env:
|
||||
MAVEN_PATH: '/usr/local/maven'
|
||||
```
|
||||
```yaml
|
||||
jobs:
|
||||
maven-build:
|
||||
env:
|
||||
MAVEN_PATH: '/usr/local/maven'
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -379,24 +379,24 @@ Travis CI
|
|||
<tr>
|
||||
<td>
|
||||
{% raw %}
|
||||
```yaml
|
||||
```yaml
|
||||
install:
|
||||
- npm install
|
||||
- npm install
|
||||
script:
|
||||
- npm run build
|
||||
- npm test
|
||||
```
|
||||
- npm run build
|
||||
- npm test
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
<td>
|
||||
{% raw %}
|
||||
```yaml
|
||||
```yaml
|
||||
name: Node.js CI
|
||||
on: [push]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v1
|
||||
|
@ -405,13 +405,12 @@ jobs:
|
|||
- run: npm install
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
```
|
||||
```
|
||||
{% endraw %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
### Next steps
|
||||
|
||||
To continue learning about the main features of {% data variables.product.prodname_actions %}, see "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)."
|
||||
|
|
|
@ -34,7 +34,7 @@ https://github.com/<OWNER>/<REPOSITORY>/workflows/<WORKFLOW_FILE_PATH>/badge.svg
|
|||
|
||||
This Markdown example adds a status badge for a workflow with the name "Greet Everyone." The `OWNER` of the repository is the `actions` organization and the `REPOSITORY` name is `hello-world`.
|
||||
|
||||
```
|
||||
```markdown
|
||||
![example workflow name](https://github.com/actions/hello-world/workflows/Greet%20Everyone/badge.svg)
|
||||
```
|
||||
|
||||
|
@ -42,7 +42,7 @@ This Markdown example adds a status badge for a workflow with the name "Greet Ev
|
|||
|
||||
This Markdown example adds a status badge for a workflow with the file path `.github/workflows/main.yml`. The `OWNER` of the repository is the `actions` organization and the `REPOSITORY` name is `hello-world`.
|
||||
|
||||
```
|
||||
```markdown
|
||||
![example workflow file path](https://github.com/actions/hello-world/workflows/.github/workflows/main.yml/badge.svg)
|
||||
```
|
||||
|
||||
|
@ -50,7 +50,7 @@ This Markdown example adds a status badge for a workflow with the file path `.gi
|
|||
|
||||
This Markdown example adds a status badge for a branch with the name `feature-1`.
|
||||
|
||||
```
|
||||
```markdown
|
||||
![example branch parameter](https://github.com/actions/hello-world/workflows/Greet%20Everyone/badge.svg?branch=feature-1)
|
||||
```
|
||||
|
||||
|
@ -58,6 +58,6 @@ This Markdown example adds a status badge for a branch with the name `feature-1`
|
|||
|
||||
This Markdown example adds a badge that displays the status of workflow runs triggered by the `pull_request` event.
|
||||
|
||||
```
|
||||
```markdown
|
||||
![example event parameter](https://github.com/actions/hello-world/workflows/Greet%20Everyone/badge.svg?event=pull_request)
|
||||
```
|
||||
|
|
|
@ -18,7 +18,7 @@ To run a workflow manually, the workflow must be configured to run on the `workf
|
|||
|
||||
To trigger the `workflow_dispatch` event on {% data variables.product.prodname_dotcom %}, your workflow must be in the default branch. Follow these steps to manually trigger a workflow run.
|
||||
|
||||
{% data reusables.repositories.permissions-statement-read %}
|
||||
{% data reusables.repositories.permissions-statement-write %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.actions-tab %}
|
||||
|
|
|
@ -75,6 +75,10 @@ In order to use property dereference syntax, the property name must:
|
|||
- start with `a-Z` or `_`.
|
||||
- be followed by `a-Z` `0-9` `-` or `_`.
|
||||
|
||||
#### Determining when to use contexts
|
||||
|
||||
{% data reusables.github-actions.using-context-or-environment-variables %}
|
||||
|
||||
#### `github` context
|
||||
|
||||
The `github` context contains information about the workflow run and the event that triggered the run. You can read most of the `github` context data in environment variables. For more information about environment variables, see "[Using environment variables](/actions/automating-your-workflow-with-github-actions/using-environment-variables)."
|
||||
|
@ -107,15 +111,14 @@ The `github` context contains information about the workflow run and the event t
|
|||
|
||||
The `env` context contains environment variables that have been set in a workflow, job, or step. For more information about setting environment variables in your workflow, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#env)."
|
||||
|
||||
The `env` context syntax allows you to use the value of an environment variable in your workflow file. If you want to use the value of an environment variable inside a runner, use the runner operating system's normal method for reading environment variables.
|
||||
The `env` context syntax allows you to use the value of an environment variable in your workflow file. You can use the `env` context in the value of any key in a **step** except for the `id` and `uses` keys. For more information on the step syntax, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps)."
|
||||
|
||||
You can only use the `env` context in the value of the `with` and `name` keys, or in a step's `if` conditional. For more information on the step syntax, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps)."
|
||||
If you want to use the value of an environment variable inside a runner, use the runner operating system's normal method for reading environment variables.
|
||||
|
||||
| Property name | Type | Description |
|
||||
|---------------|------|-------------|
|
||||
| `env` | `object` | This context changes for each step in a job. You can access this context from any step in a job. |
|
||||
| `env.<env name>` | `string` | The value of a specific environment variable. |
|
||||
|
||||
| `env.<env_name>` | `string` | The value of a specific environment variable. |
|
||||
|
||||
#### `job` context
|
||||
|
||||
|
@ -183,27 +186,27 @@ jobs:
|
|||
steps:
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
GITHUB_CONTEXT: ${{ toJSON(github) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
- name: Dump job context
|
||||
env:
|
||||
JOB_CONTEXT: ${{ toJson(job) }}
|
||||
JOB_CONTEXT: ${{ toJSON(job) }}
|
||||
run: echo "$JOB_CONTEXT"
|
||||
- name: Dump steps context
|
||||
env:
|
||||
STEPS_CONTEXT: ${{ toJson(steps) }}
|
||||
STEPS_CONTEXT: ${{ toJSON(steps) }}
|
||||
run: echo "$STEPS_CONTEXT"
|
||||
- name: Dump runner context
|
||||
env:
|
||||
RUNNER_CONTEXT: ${{ toJson(runner) }}
|
||||
RUNNER_CONTEXT: ${{ toJSON(runner) }}
|
||||
run: echo "$RUNNER_CONTEXT"
|
||||
- name: Dump strategy context
|
||||
env:
|
||||
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
|
||||
STRATEGY_CONTEXT: ${{ toJSON(strategy) }}
|
||||
run: echo "$STRATEGY_CONTEXT"
|
||||
- name: Dump matrix context
|
||||
env:
|
||||
MATRIX_CONTEXT: ${{ toJson(matrix) }}
|
||||
MATRIX_CONTEXT: ${{ toJSON(matrix) }}
|
||||
run: echo "$MATRIX_CONTEXT"
|
||||
```
|
||||
{% endraw %}
|
||||
|
@ -345,7 +348,7 @@ The value for `array` can be an array or a string. All values in `array` are con
|
|||
|
||||
`join(github.event.issue.labels.*.name, ', ')` may return 'bug, help wanted'
|
||||
|
||||
#### toJson
|
||||
#### toJSON
|
||||
|
||||
`toJSON(value)`
|
||||
|
||||
|
@ -355,13 +358,13 @@ Returns a pretty-print JSON representation of `value`. You can use this function
|
|||
|
||||
`toJSON(job)` might return `{ "status": "Success" }`
|
||||
|
||||
#### fromJson
|
||||
#### fromJSON
|
||||
|
||||
`fromJSON(value)`
|
||||
|
||||
Returns a JSON object for `value`. You can use this function to provide a JSON object as an evaluated expression.
|
||||
Returns a JSON object or JSON data type for `value`. You can use this function to provide a JSON object as an evaluated expression or to convert environment variables from a string.
|
||||
|
||||
##### Example
|
||||
##### Example returning a JSON object
|
||||
|
||||
This workflow sets a JSON matrix in one job, and passes it to the next job using an output and `fromJSON`.
|
||||
|
||||
|
@ -381,12 +384,33 @@ jobs:
|
|||
needs: job1
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix: ${{fromJson(needs.job1.outputs.matrix)}}
|
||||
matrix: ${{fromJSON(needs.job1.outputs.matrix)}}
|
||||
steps:
|
||||
- run: build
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
##### Example returning a JSON data type
|
||||
|
||||
This workflow uses `fromJSON` to convert environment variables from a string to a Boolean or integer.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: print
|
||||
on: push
|
||||
env:
|
||||
continue: true
|
||||
time: 3
|
||||
jobs:
|
||||
job1:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- continue-on-error: ${{ fromJSON(env.continue) }}
|
||||
timeout-minutes: ${{ fromJSON(env.time) }}
|
||||
run: echo ...
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
#### hashFiles
|
||||
|
||||
`hashFiles(path)`
|
||||
|
|
|
@ -57,6 +57,16 @@ We strongly recommend that actions use environment variables to access the files
|
|||
| `GITHUB_API_URL` | Returns the API URL. For example: `{% data variables.product.api_url_code %}`.
|
||||
| `GITHUB_GRAPHQL_URL` | Returns the GraphQL API URL. For example: `{% data variables.product.graphql_url_code %}`.
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Note:** If you need to use a workflow run's URL from within a job, you can combine these environment variables: `$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID`
|
||||
|
||||
{% endtip %}
|
||||
|
||||
#### Determining when to use default environment variables or contexts
|
||||
|
||||
{% data reusables.github-actions.using-context-or-environment-variables %}
|
||||
|
||||
### Naming conventions for environment variables
|
||||
|
||||
{% note %}
|
||||
|
|
|
@ -80,6 +80,8 @@ You can use these operators in any of the five fields:
|
|||
|
||||
You can use [crontab guru](https://crontab.guru/) to help generate your cron syntax and confirm what time it will run. To help you get started, there is also a list of [crontab guru examples](https://crontab.guru/examples.html).
|
||||
|
||||
Notifications for scheduled workflows are sent to the user who last modified the cron syntax in the workflow file. For more information, please see "[Notifications for workflow runs](/actions/guides/about-continuous-integration#notifications-for-workflow-runs)."
|
||||
|
||||
### Manual events
|
||||
|
||||
You can manually trigger workflow runs. To trigger specific workflows in a repository, use the `workflow_dispatch` event. To trigger more than one workflow in a repository and create custom events and event types, use the `repository_dispatch` event.
|
||||
|
|
|
@ -83,44 +83,11 @@ If there is a tool that you'd like to request, please open an issue at [actions/
|
|||
|
||||
{% endnote %}
|
||||
|
||||
Windows and Ubuntu runners are hosted in Azure and have the same IP address ranges as Azure Data centers. Currently, all Windows and Ubuntu {% data variables.product.prodname_dotcom %}-hosted runners are in the following Azure regions:
|
||||
Windows and Ubuntu runners are hosted in Azure and subsequently have the same IP address ranges as the Azure datacenters. macOS runners are hosted in {% data variables.product.prodname_dotcom %}'s own macOS cloud.
|
||||
|
||||
- East US (`eastus`)
|
||||
- East US 2 (`eastus2`)
|
||||
- West US 2 (`westus2`)
|
||||
- Central US (`centralus`)
|
||||
- South Central US (`southcentralus`)
|
||||
To get a list of IP address ranges that {% data variables.product.prodname_actions %} uses for {% data variables.product.prodname_dotcom %}-hosted runners, you can use the {% data variables.product.prodname_dotcom %} REST API . For more information, see the `actions` key in the response of the "[Get GitHub meta information](/rest/reference/meta#get-github-meta-information)" endpoint. You can use this list of IP addresses if you require an allow-list to prevent unauthorized access to your internal resources.
|
||||
|
||||
Microsoft updates the Azure IP address ranges weekly in a JSON file that you can download from the [Azure IP Ranges and Service Tags - Public Cloud](https://www.microsoft.com/en-us/download/details.aspx?id=56519) website. You can use this range of IP addresses if you require an allow-list to prevent unauthorized access to your internal resources.
|
||||
|
||||
The JSON file contains an array called `values`. Inside that array, you can find the supported IP addresses in an object with a `name` and `id` of the Azure region, for example `"AzureCloud.eastus2"`.
|
||||
|
||||
You can find the supported IP address ranges in the `"addressPrefixes"` object. This is a condensed example of the JSON file.
|
||||
|
||||
```json
|
||||
{
|
||||
"changeNumber": 84,
|
||||
"cloud": "Public",
|
||||
"values": [
|
||||
{
|
||||
"name": "AzureCloud.eastus2",
|
||||
"id": "AzureCloud.eastus2",
|
||||
"properties": {
|
||||
"changeNumber": 33,
|
||||
"region": "eastus2",
|
||||
"platform": "Azure",
|
||||
"systemService": "",
|
||||
"addressPrefixes": [
|
||||
"13.68.0.0/17",
|
||||
"13.77.64.0/18",
|
||||
"13.104.147.0/25",
|
||||
...
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
The list of {% data variables.product.prodname_actions %} IP addresses returned by the API is updated once a week.
|
||||
|
||||
### File systems
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ During the execution of a workflow, the runner generates temporary files that ca
|
|||
|
||||
**Warning:** Powershell does not use UTF-8 by default. Make sure you write files using the correct encoding. For example, you need to set UTF-8 encoding when you set the path:
|
||||
|
||||
```
|
||||
```yaml
|
||||
steps:
|
||||
- run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
```
|
||||
|
@ -287,7 +287,7 @@ For multiline strings, you may use a delimiter with the following syntax.
|
|||
##### Example
|
||||
|
||||
In this example, we use `EOF` as a delimiter and set the `JSON_RESPONSE` environment variable to the value of the curl response.
|
||||
```
|
||||
```yaml
|
||||
steps:
|
||||
- name: Set the value
|
||||
id: step_one
|
||||
|
|
|
@ -187,7 +187,7 @@ For more information about cron syntax, see "[Events that trigger workflows](/ac
|
|||
|
||||
### `env`
|
||||
|
||||
A `map` of environment variables that are available to all jobs and steps in the workflow. You can also set environment variables that are only available to a job or step. For more information, see [`jobs.<job_id>.env`](#jobsjob_idenv) and [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv).
|
||||
A `map` of environment variables that are available to the steps of all jobs in the workflow. You can also set environment variables that are only available to the steps of a single job or to a single step. For more information, see [`jobs.<job_id>.env`](#jobsjob_idenv) and [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv).
|
||||
|
||||
{% data reusables.repositories.actions-env-var-note %}
|
||||
|
||||
|
@ -705,7 +705,7 @@ You can set the `shell` value to a template string using `command […options] {
|
|||
For built-in shell keywords, we provide the following defaults that are executed by {% data variables.product.prodname_dotcom %}-hosted runners. You should use these guidelines when running shell scripts.
|
||||
|
||||
- `bash`/`sh`:
|
||||
- Fail-fast behavior using `set -e o pipefail`: Default for `bash` and built-in `shell`. It is also the default when you don't provide an option on non-Windows platforms.
|
||||
- Fail-fast behavior using `set -eo pipefail`: Default for `bash` and built-in `shell`. It is also the default when you don't provide an option on non-Windows platforms.
|
||||
- You can opt out of fail-fast and take full control by providing a template string to the shell options. For example, `bash {0}`.
|
||||
- sh-like shells exit with the exit code of the last command executed in a script, which is also the default behavior for actions. The runner will report the status of the step as fail/succeed based on this exit code.
|
||||
|
||||
|
|
|
@ -466,20 +466,23 @@ ghe-webhook-logs
|
|||
```
|
||||
|
||||
To show all failed hook deliveries in the past day:
|
||||
{% if currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
```shell
|
||||
ghe-webhook-logs -f -a <em>YYYY-MM-DD</em>
|
||||
```
|
||||
|
||||
The date format should be `YYYY-MM-DD`, `YYYY-MM-DD HH:MM:SS`, or `YYYY-MM-DD HH:MM:SS (+/-) HH:M`.
|
||||
{% else %}
|
||||
```shell
|
||||
ghe-webhook-logs -f -a <em>YYYYMMDD</em>
|
||||
```
|
||||
{% endif %}
|
||||
|
||||
To show the full hook payload, result, and any exceptions for the delivery:
|
||||
```shell
|
||||
ghe-webhook-logs -g <em>delivery-guid</em> -v
|
||||
```
|
||||
|
||||
To show global webhook deliveries:
|
||||
```shell
|
||||
ghe-webhook-logs --global
|
||||
```
|
||||
|
||||
### Clustering
|
||||
|
||||
#### ghe-cluster-status
|
||||
|
|
|
@ -80,6 +80,14 @@ If backup attempts overlap, the `ghe-backup` command will abort with an error me
|
|||
|
||||
In the event of prolonged outage or catastrophic event at the primary site, you can restore {% data variables.product.product_location %} by provisioning another {% data variables.product.prodname_enterprise %} appliance and performing a restore from the backup host. You must add the backup host's SSH key to the target {% data variables.product.prodname_enterprise %} appliance as an authorized SSH key before restoring an appliance.
|
||||
|
||||
{%if currentVersion ver_gt "enterprise-server@2.22"%}
|
||||
{% note %}
|
||||
|
||||
**Note:** If {% data variables.product.product_location %} has {% data variables.product.prodname_actions %} enabled, you must first configure the {% data variables.product.prodname_actions %} external storage provider on the replacement appliance before running the the `ghe-restore` command. For more information, see "[Backing up and restoring {% data variables.product.prodname_ghe_server %} with {% data variables.product.prodname_actions %} enabled](/admin/github-actions/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled)."
|
||||
|
||||
{% endnote %}
|
||||
{% endif %}
|
||||
|
||||
To restore {% data variables.product.product_location %} from the last successful snapshot, use the `ghe-restore` command. You should see output similar to this:
|
||||
|
||||
```shell
|
||||
|
|