Skip to content

Commit 21d480a

Browse files
hubwritergithub-actionsisaacmbrown
authored
Actions: Help users find starter workflows earlier in the learning process (#42483)
Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Isaac Brown <101839405+isaacmbrown@users.noreply.github.com>
1 parent 8158d6d commit 21d480a

27 files changed

+486
-322
lines changed
Loading

content/actions/automating-builds-and-tests/building-and-testing-go.md

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,59 @@ You should already be familiar with YAML syntax and how it's used with {% data v
2929

3030
We recommend that you have a basic understanding of the Go language. For more information, see [Getting started with Go](https://golang.org/doc/tutorial/getting-started).
3131

32-
## Using the Go starter workflow
32+
## Using a Go starter workflow
3333

34-
{% data variables.product.prodname_dotcom %} provides a Go starter workflow that should work for most Go projects. This guide includes examples that you can use to customize the starter workflow. For more information, see the [Go starter workflow](https://github.com/actions/starter-workflows/blob/main/ci/go.yml).
34+
{% data reusables.actions.starter-workflow-get-started %}
3535

36-
To get started quickly, add the starter workflow to the `.github/workflows` directory of your repository.
36+
{% data variables.product.prodname_dotcom %} provides a Go starter workflow that should work for most Go projects. The subsequent sections of this guide give examples of how you can customize this starter workflow.
3737

38-
```yaml copy
39-
name: Go package
38+
{% data reusables.repositories.navigate-to-repo %}
39+
{% data reusables.repositories.actions-tab %}
40+
{% data reusables.actions.new-starter-workflow %}
41+
1. The "{% ifversion actions-starter-template-ui %}Choose a workflow{% else %}Choose a workflow template{% endif %}" page shows a selection of recommended starter workflows. Search for "go".
42+
1. Filter the selection of workflows by clicking **Continuous integration**.
43+
1. On the "Go - by {% data variables.product.prodname_actions %}" workflow, click {% ifversion actions-starter-template-ui %}**Configure**{% else %}**Set up this workflow**{% endif %}.
4044

41-
on: [push]
45+
![Screenshot of the "Choose a workflow" page. The "Configure" button on the "Go" workflow is highlighted with an orange outline.](/assets/images/help/actions/starter-workflow-go.png)
4246

43-
jobs:
44-
build:
47+
{%- ifversion ghes or ghae %}
48+
If you don't find the "Go - by {% data variables.product.prodname_actions %}" starter workflow, copy the following workflow code to a new file called `go.yml` in the `.github/workflows` directory of your repository.
4549

46-
runs-on: ubuntu-latest
47-
steps:
48-
- uses: {% data reusables.actions.action-checkout %}
50+
```yaml copy
51+
name: Go
4952

50-
- name: Set up Go
51-
uses: {% data reusables.actions.action-setup-go %}
52-
with:
53-
go-version: '1.15'
53+
on:
54+
push:
55+
branches: [ "main" ]
56+
pull_request:
57+
branches: [ "main" ]
5458

55-
- name: Build
56-
run: go build -v ./...
59+
jobs:
60+
build:
5761

58-
- name: Test
59-
run: go test -v ./...
60-
```
62+
runs-on: self-hosted
63+
steps:
64+
- uses: {% data reusables.actions.action-checkout %}
65+
66+
- name: Set up Go
67+
uses: {% data reusables.actions.action-setup-go %}
68+
with:
69+
go-version: '1.20'
70+
71+
- name: Build
72+
run: go build -v ./...
73+
74+
- name: Test
75+
run: go test -v ./...
76+
```
77+
{%- endif %}
78+
79+
1. Edit the workflow as required. For example, change the version of Go.
80+
1. Click **Commit changes**.
81+
82+
{% ifversion fpt or ghec %}
83+
The `go.yml` workflow file is added to the `.github/workflows` directory of your repository.
84+
{% endif %}
6185

6286
## Specifying a Go version
6387

@@ -80,7 +104,7 @@ jobs:
80104
runs-on: ubuntu-latest
81105
strategy:
82106
matrix:
83-
go-version: [ '1.14', '1.15', '1.16.x' ]
107+
go-version: [ '1.19', '1.20', '1.21.x' ]
84108
85109
steps:
86110
- uses: {% data reusables.actions.action-checkout %}
@@ -95,14 +119,14 @@ jobs:
95119

96120
### Using a specific Go version
97121

98-
You can configure your job to use a specific version of Go, such as `1.16.2`. Alternatively, you can use semantic version syntax to get the latest minor release. This example uses the latest patch release of Go 1.16:
122+
You can configure your job to use a specific version of Go, such as `1.20.8`. Alternatively, you can use semantic version syntax to get the latest minor release. This example uses the latest patch release of Go 1.21:
99123

100124
```yaml copy
101-
- name: Setup Go 1.16.x
125+
- name: Setup Go 1.21.x
102126
uses: {% data reusables.actions.action-setup-go %}
103127
with:
104128
# Semantic version range syntax or exact version of Go
105-
go-version: '1.16.x'
129+
go-version: '1.21.x'
106130
```
107131

108132
## Installing dependencies
@@ -115,7 +139,7 @@ You can use `go get` to install dependencies:
115139
- name: Setup Go
116140
uses: {% data reusables.actions.action-setup-go %}
117141
with:
118-
go-version: '1.16.x'
142+
go-version: '1.21.x'
119143
- name: Install dependencies
120144
run: |
121145
go get .
@@ -150,7 +174,7 @@ When caching is enabled, the `setup-go` action searches for the dependency file,
150174
- name: Setup Go
151175
uses: {% data reusables.actions.action-setup-go %}
152176
with:
153-
go-version: '1.16.x'
177+
go-version: '1.21.x'
154178
cache: true
155179
```
156180

@@ -187,7 +211,7 @@ jobs:
187211
- name: Setup Go
188212
uses: {% data reusables.actions.action-setup-go %}
189213
with:
190-
go-version: '1.16.x'
214+
go-version: '1.21.x'
191215
- name: Install dependencies
192216
run: go get .
193217
- name: Build
@@ -213,7 +237,7 @@ jobs:
213237
runs-on: ubuntu-latest
214238
strategy:
215239
matrix:
216-
go-version: [ '1.14', '1.15', '1.16.x' ]
240+
go-version: [ '1.19', '1.20', '1.21.x' ]
217241
218242
steps:
219243
- uses: {% data reusables.actions.action-checkout %}

content/actions/automating-builds-and-tests/building-and-testing-java-with-ant.md

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ topics:
1515
- Java
1616
- Ant
1717
shortTitle: Build & test Java & Ant
18-
layout: inline
1918
---
2019

2120
{% data reusables.actions.enterprise-github-hosted-runners %}
@@ -40,39 +39,53 @@ We recommend that you have a basic understanding of Java and the Ant framework.
4039

4140
{% data reusables.actions.enterprise-setup-prereq %}
4241

43-
## Using the Ant starter workflow
44-
45-
{% data variables.product.prodname_dotcom %} provides an Ant starter workflow that will work for most Ant-based Java projects. For more information, see the [Ant starter workflow](https://github.com/actions/starter-workflows/blob/main/ci/ant.yml). {% data reusables.actions.workflows.starter-workflows %}
46-
47-
To get started quickly, you can choose the preconfigured Ant starter workflow when you create a new workflow. For more information, see the "[AUTOTITLE](/actions/quickstart)."
48-
49-
You can also add this workflow manually by creating a new file in the `.github/workflows` directory of your repository.
50-
51-
```yaml annotate copy
52-
# {% data reusables.actions.workflows.workflow-syntax-name %}
53-
name: Java CI
54-
55-
#
56-
on: [push]
57-
#
58-
jobs:
59-
build:
60-
{% data reusables.actions.example-github-runner-comment %}
61-
runs-on: ubuntu-latest
62-
#
63-
steps:
64-
{% data reusables.actions.workflows.workflow-checkout-step-explainer %}
65-
- uses: {% data reusables.actions.action-checkout %}
66-
{% data reusables.actions.workflows.setup-java-step-explainer %}
67-
- name: Set up JDK 17
68-
uses: {% data reusables.actions.action-setup-java %}
69-
with:
70-
java-version: '17'
71-
distribution: 'temurin'
72-
# This step runs the default target in your `build.xml` file in non-interactive mode.
73-
- name: Build with Ant
74-
run: ant -noinput -buildfile build.xml
75-
```
42+
## Using an Ant starter workflow
43+
44+
{% data reusables.actions.starter-workflow-get-started %}
45+
46+
{% data variables.product.prodname_dotcom %} provides a starter workflow for Ant that should work for most Java with Ant projects. The subsequent sections of this guide give examples of how you can customize this starter workflow.
47+
48+
{% data reusables.repositories.navigate-to-repo %}
49+
{% data reusables.repositories.actions-tab %}
50+
{% data reusables.actions.new-starter-workflow %}
51+
1. The "{% ifversion actions-starter-template-ui %}Choose a workflow{% else %}Choose a workflow template{% endif %}" page shows a selection of recommended starter workflows. Search for "Java with Ant".
52+
1. On the "Java with Ant" workflow, click {% ifversion actions-starter-template-ui %}**Configure**{% else %}**Set up this workflow**{% endif %}.
53+
54+
{%- ifversion ghes or ghae %}
55+
56+
If you don't find the "Java with Ant" starter workflow, copy the following workflow code to a new file called `ant.yml` in the `.github/workflows` directory of your repository.
57+
58+
```yaml copy
59+
name: Java CI
60+
61+
on:
62+
push:
63+
branches: [ $default-branch ]
64+
pull_request:
65+
branches: [ $default-branch ]
66+
67+
jobs:
68+
build:
69+
runs-on: ubuntu-latest
70+
71+
steps:
72+
- uses: {% data reusables.actions.action-checkout %}
73+
- name: Set up JDK 11
74+
uses: {% data reusables.actions.action-setup-java %}
75+
with:
76+
java-version: '11'
77+
distribution: 'temurin'
78+
- name: Build with Ant
79+
run: ant -noinput -buildfile build.xml
80+
```
81+
{%- endif %}
82+
83+
1. Edit the workflow as required. For example, change the Java version.
84+
1. Click **Commit changes**.
85+
86+
{% ifversion fpt or ghec %}
87+
The `ant.yml` workflow file is added to the `.github/workflows` directory of your repository.
88+
{% endif %}
7689

7790
{% data reusables.actions.java-jvm-architecture %}
7891

content/actions/automating-builds-and-tests/building-and-testing-java-with-gradle.md

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ topics:
1515
- Java
1616
- Gradle
1717
shortTitle: Build & test Java & Gradle
18-
layout: inline
1918
---
2019

2120
{% data reusables.actions.enterprise-github-hosted-runners %}
@@ -40,54 +39,61 @@ We recommend that you have a basic understanding of Java and the Gradle framewor
4039

4140
{% data reusables.actions.enterprise-setup-prereq %}
4241

43-
## Using the Gradle starter workflow
44-
45-
{% data variables.product.prodname_dotcom %} provides a Gradle starter workflow that will work for most Gradle-based Java projects. For more information, see the [Gradle starter workflow](https://github.com/actions/starter-workflows/blob/main/ci/gradle.yml). {% data reusables.actions.workflows.starter-workflows %}
46-
47-
To get started quickly, you can choose the preconfigured Gradle starter workflow when you create a new workflow. For more information, see the "[AUTOTITLE](/actions/quickstart)."
48-
49-
You can also add this workflow manually by creating a new file in the `.github/workflows` directory of your repository.
50-
51-
{% note %}
52-
53-
**Notes:**
54-
55-
- {% data reusables.actions.actions-not-certified-by-github %}
56-
- {% data reusables.actions.actions-use-sha-pinning %}
57-
58-
{% endnote %}
59-
60-
```yaml annotate copy
61-
# {% data reusables.actions.workflows.workflow-syntax-name %}
62-
name: Java CI
63-
64-
#
65-
on: [push]
66-
#
67-
jobs:
68-
build:
69-
70-
{% data reusables.actions.example-github-runner-comment %}
71-
runs-on: ubuntu-latest
72-
#
73-
steps:
74-
{% data reusables.actions.workflows.workflow-checkout-step-explainer %}
75-
- uses: {% data reusables.actions.action-checkout %}
76-
{% data reusables.actions.workflows.setup-java-step-explainer %}
77-
- name: Set up JDK 17
78-
uses: {% data reusables.actions.action-setup-java %}
79-
with:
80-
java-version: '17'
81-
distribution: 'temurin'
82-
# The "Validate Gradle wrapper" step validates the checksums of Gradle Wrapper JAR files present in the source tree.
83-
- name: Validate Gradle wrapper
84-
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3
85-
# The "Build with Gradle" step does a build using the `gradle/gradle-build-action` action provided by the Gradle organization on {% data variables.product.prodname_dotcom %}. The action takes care of invoking Gradle, collecting results, and caching state between jobs. For more information see [`gradle/gradle-build-action`](https://github.com/gradle/gradle-build-action).
86-
- name: Build with Gradle
87-
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
88-
with:
89-
arguments: build
90-
```
42+
## Using a Gradle starter workflow
43+
44+
{% data reusables.actions.starter-workflow-get-started %}
45+
46+
{% data variables.product.prodname_dotcom %} provides a starter workflow for Gradle that should work for most Java with Gradle projects. The subsequent sections of this guide give examples of how you can customize this starter workflow.
47+
48+
{% data reusables.repositories.navigate-to-repo %}
49+
{% data reusables.repositories.actions-tab %}
50+
{% data reusables.actions.new-starter-workflow %}
51+
1. The "{% ifversion actions-starter-template-ui %}Choose a workflow{% else %}Choose a workflow template{% endif %}" page shows a selection of recommended starter workflows. Search for "Java with Gradle".
52+
1. On the "Java with Gradle" workflow, click {% ifversion actions-starter-template-ui %}**Configure**{% else %}**Set up this workflow**{% endif %}.
53+
54+
{%- ifversion ghes or ghae %}
55+
56+
If you don't find the "Java with Gradle" starter workflow, copy the following workflow code to a new file called `gradle.yml` in the `.github/workflows` directory of your repository.
57+
58+
```yaml copy
59+
name: Java CI with Gradle
60+
61+
on:
62+
push:
63+
branches: [ "main" ]
64+
pull_request:
65+
branches: [ "main" ]
66+
67+
permissions:
68+
contents: read
69+
70+
jobs:
71+
build:
72+
runs-on: ubuntu-latest
73+
74+
steps:
75+
- uses: {% data reusables.actions.action-checkout %}
76+
- name: Set up JDK 11
77+
uses: {% data reusables.actions.action-setup-java %}
78+
with:
79+
java-version: '11'
80+
distribution: 'temurin'
81+
- name: Build with Gradle
82+
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
83+
with:
84+
arguments: build
85+
```
86+
{%- endif %}
87+
88+
1. Edit the workflow as required. For example, change the Java version.
89+
90+
{% indented_data_reference reusables.actions.third-party-actions spaces=3 %}
91+
92+
1. Click **Commit changes**.
93+
94+
{% ifversion fpt or ghec %}
95+
The `gradle.yml` workflow file is added to the `.github/workflows` directory of your repository.
96+
{% endif %}
9197

9298
{% data reusables.actions.java-jvm-architecture %}
9399

0 commit comments

Comments
 (0)