|
| 1 | +--- |
| 2 | +title: Customizing GitHub-hosted runners |
| 3 | +intro: >- |
| 4 | + You can install additional software on GitHub-hosted runners as a |
| 5 | + part of your workflow. |
| 6 | +product: '{% data reusables.gated-features.actions %}' |
| 7 | +versions: |
| 8 | + free-pro-team: '*' |
| 9 | + enterprise-server: '>=2.22' |
| 10 | +type: tutorial |
| 11 | +topics: |
| 12 | + - Workflows |
| 13 | +--- |
| 14 | + |
| 15 | +{% data reusables.actions.enterprise-github-hosted-runners %} |
| 16 | + |
| 17 | +If you require additional software packages on {% data variables.product.prodname_dotcom %}-hosted runners, you can create a job that installs the packages as part of your workflow. |
| 18 | + |
| 19 | +To see which packages are already installed by default, see "[Preinstalled software](/actions/using-github-hosted-runners/about-github-hosted-runners#preinstalled-software)." |
| 20 | + |
| 21 | +This guide demonstrates how to create a job that installs additional software on a {% data variables.product.prodname_dotcom %}-hosted runner. |
| 22 | + |
| 23 | +### Installing software on Ubuntu runners |
| 24 | + |
| 25 | +The following example demonstrates how to install an `apt` package as part of a job. |
| 26 | + |
| 27 | +{% raw %} |
| 28 | +```yaml |
| 29 | +name: Build on Ubuntu |
| 30 | +on: push |
| 31 | + |
| 32 | +jobs: |
| 33 | + build: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - name: Check out repository code |
| 37 | + uses: actions/checkout@v2 |
| 38 | + - name: Install jq tool |
| 39 | + run: | |
| 40 | + sudo apt-get update |
| 41 | + sudo apt-get install jq |
| 42 | +``` |
| 43 | +{% endraw %} |
| 44 | +
|
| 45 | +{% note %} |
| 46 | +
|
| 47 | +**Note:** Always run `sudo apt-get update` before installing a package. In case the `apt` index is stale, this command fetches and re-indexes any available packages, which helps prevent package installation failures. |
| 48 | + |
| 49 | +{% endnote %} |
| 50 | + |
| 51 | +### Installing software on macOS runners |
| 52 | + |
| 53 | +The following example demonstrates how to install Brew packages and casks as part of a job. |
| 54 | + |
| 55 | +{% raw %} |
| 56 | +```yaml |
| 57 | +name: Build on macOS |
| 58 | +on: push |
| 59 | +
|
| 60 | +jobs: |
| 61 | + build: |
| 62 | + runs-on: macos-latest |
| 63 | + steps: |
| 64 | + - name: Check out repository code |
| 65 | + uses: actions/checkout@v2 |
| 66 | + - name: Install GitHub CLI |
| 67 | + run: | |
| 68 | + brew update |
| 69 | + brew install gh |
| 70 | + - name: Install Microsoft Edge |
| 71 | + run: | |
| 72 | + brew update |
| 73 | + brew install --cask microsoft-edge |
| 74 | +``` |
| 75 | +{% endraw %} |
| 76 | + |
| 77 | +### Installing software on Windows runners |
| 78 | + |
| 79 | +The following example demonstrates how to use [Chocolatey](https://community.chocolatey.org/packages) to install the {% data variables.product.prodname_dotcom %} CLI as part of a job. |
| 80 | + |
| 81 | +{% raw %} |
| 82 | +```yaml |
| 83 | +name: Build on Windows |
| 84 | +on: push |
| 85 | +jobs: |
| 86 | + build: |
| 87 | + runs-on: windows-latest |
| 88 | + steps: |
| 89 | + - run: choco install gh |
| 90 | + - run: gh version |
| 91 | +``` |
| 92 | +{% endraw %} |
0 commit comments