@@ -46,28 +46,15 @@ module mode by default. To turn it on explicitly, set `GO111MODULE=on`.
46
46
47
47
#### How do I set environent variables?
48
48
49
- They can only be set for each step, as far as the documentation covers:
49
+ They can be set up via ` env ` for an [ entire
50
+ workflow] ( https://help.github.com/en/articles/workflow-syntax-for-github-actions#env ) ,
51
+ a job, or for each step:
50
52
51
53
```
52
- - name: Download Go dependencies with a custom proxy
53
- env:
54
- GOPROXY: "https://proxy.company.com"
55
- run: go mod download
56
- ```
57
-
58
- On Go 1.13 and later, this can be simplified:
59
-
60
- ```
61
- - name: Set Go env vars
62
- run: go env -w GOPROXY="https://proxy.company.com"
63
- ```
64
-
65
- There also appears to be an undocumented way to set global environment
66
- variables, as found by [ Nick Craig-Wood] ( https://twitter.com/njcw ) :
67
-
68
- ```
69
- - name: Set global env vars
70
- run: echo '::set-env name=NAME::VALUE'
54
+ env:
55
+ GOPROXY: "https://proxy.company.com"
56
+ jobs:
57
+ [...]
71
58
```
72
59
73
60
#### How do I set up caching between builds?
@@ -147,17 +134,19 @@ Use `sudo apt`, making sure to only run the step on Linux:
147
134
148
135
# ### How do I set up a GOPATH build?
149
136
150
- We can set up a GOPATH with global environment variables, as explained earlier :
137
+ Declare GOPATH and clone inside it :
151
138
152
139
` ` `
153
- - name: Checkout code
154
- uses: actions/checkout@v1
155
- with:
156
- path: ./src/github.com/${{ github.repository }}
157
- - name: Set GOPATH
158
- run: |
159
- echo '::set-env name=GOPATH::${{ runner.workspace }}'
160
- echo '::add-path::${{ runner.workspace }}/bin'
140
+ jobs:
141
+ test-gopath:
142
+ env:
143
+ GOPATH: ${{ runner.workspace }}
144
+ GO111MODULE: off
145
+ steps:
146
+ - name: Checkout code
147
+ uses: actions/checkout@v1
148
+ with:
149
+ path: ./src/github.com/${{ github.repository }}
161
150
` ` `
162
151
163
152
# # Quick links
0 commit comments