2
2
3
3
[ GitHub Actions] ( https://github.com/features/actions ) includes CI/CD for free
4
4
for Open Source repositories. This document contains information on making it
5
- work well for [ Go] ( https://golang.org ) . See them [ in
5
+ work well for [ Go] ( https://go.dev/ ) . See them [ in
6
6
action] ( https://github.com/mvdan/github-actions-golang/actions ) :
7
7
8
8
``` yaml
@@ -48,7 +48,7 @@ Go 1.12 and later do the same if a `go.mod` file is present.
48
48
# ### How do I set environment variables?
49
49
50
50
They can be set up via `env` for an [entire
51
- workflow](https://docs.github.com/en/actions/reference /workflow-syntax-for-github-actions#env),
51
+ workflow](https://docs.github.com/en/actions/learn-github-actions /workflow-syntax-for-github-actions#env),
52
52
a job, or for each step :
53
53
54
54
` ` ` yaml
60
60
61
61
# ### How do I set environment variables at run-time?
62
62
63
- You can use [environment files](https://docs.github.com/en/actions/reference /workflow-commands-for-github-actions#environment-files)
63
+ You can use [environment files](https://docs.github.com/en/actions/learn-github-actions /workflow-commands-for-github-actions#environment-files)
64
64
to set environment variables or add an element to `$PATH`. For example :
65
65
66
66
` ` ` yaml
@@ -109,13 +109,13 @@ You can also include Go's build cache, to improve incremental builds:
109
109
110
110
This is demonstrated via the `test-cache` job [in this very repository](https://github.com/mvdan/github-actions-golang/actions).
111
111
112
- See [this guide](https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows)
112
+ See [this guide](https://docs.github.com/en/actions/advanced- guides/caching-dependencies-to-speed-up-workflows)
113
113
for more details.
114
114
115
115
# ### How do I run a step conditionally?
116
116
117
117
You can use `if` conditionals, using their [custom expression
118
- language](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for- github-actions) :
118
+ language](https://docs.github.com/en/actions/learn- github-actions/contexts ) :
119
119
120
120
` ` ` yaml
121
121
- name: Run end-to-end tests on Linux
@@ -126,9 +126,9 @@ language](https://docs.github.com/en/actions/reference/context-and-expression-sy
126
126
# ### How do I set up a custom build matrix?
127
127
128
128
You can [include extra matrix
129
- jobs](https://docs.github.com/en/actions/reference /workflow-syntax-for-github-actions#example-including-new-combinations),
129
+ jobs](https://docs.github.com/en/actions/learn-github-actions /workflow-syntax-for-github-actions#example-including-new-combinations),
130
130
and you can [exclude specific matrix
131
- jobs](https://docs.github.com/en/actions/reference /workflow-syntax-for-github-actions#example-excluding-configurations-from-a-matrix).
131
+ jobs](https://docs.github.com/en/actions/learn-github-actions /workflow-syntax-for-github-actions#example-excluding-configurations-from-a-matrix).
132
132
133
133
# ### How do I run multiline scripts?
134
134
@@ -144,11 +144,11 @@ jobs](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-ac
144
144
The biggest difference is the UI; workflow results are shown separately.
145
145
Grouping jobs in workflows can also be useful if one wants to customize the
146
146
workflow triggers, or to set up dependencies via
147
- [needs](https://docs.github.com/en/actions/reference /workflow-syntax-for-github-actions#jobsjob_idneeds).
147
+ [needs](https://docs.github.com/en/actions/learn-github-actions /workflow-syntax-for-github-actions#jobsjob_idneeds).
148
148
149
149
# ### How do I set up a secret environment variable?
150
150
151
- Follow [these steps](https://docs.github.com/en/actions/reference /encrypted-secrets)
151
+ Follow [these steps](https://docs.github.com/en/actions/security-guides /encrypted-secrets)
152
152
to set up the secret in the repo's settings. After adding a secret like
153
153
`FOO_SECRET`, use it on a step as follows :
154
154
@@ -165,7 +165,7 @@ It's possible to install modules from private GitHub repositories without using
165
165
your own proxy. You'll need to add a
166
166
[personal access token](https://github.com/settings/tokens) as a secret
167
167
environment variable, as well as configure
168
- [GOPRIVATE](https://golang.org /ref/mod#private-modules).
168
+ [GOPRIVATE](https://go.dev /ref/mod#private-modules).
169
169
170
170
` ` ` yaml
171
171
- name: Configure git for private modules
@@ -215,7 +215,7 @@ jobs:
215
215
216
216
* Concepts, rate limits, etc: https://docs.github.com/en/actions/learn-github-actions
217
217
218
- * Syntax and fields reference: https://docs.github.com/en/actions/reference /workflow-syntax-for-github-actions
218
+ * Syntax and fields reference: https://docs.github.com/en/actions/learn-github-actions /workflow-syntax-for-github-actions
219
219
220
220
* Environment reference: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
221
221
0 commit comments