mirror of
https://github.com/go-task/task.git
synced 2026-06-28 23:24:25 +00:00
@@ -442,8 +442,13 @@ tasks:
|
||||
## Platform specific tasks and commands
|
||||
|
||||
If you want to restrict the running of tasks to explicit platforms, this can be achieved
|
||||
using the `platforms` key. Tasks can be restricted to a specific OS, architecture or a
|
||||
using the `platforms:` key. Tasks can be restricted to a specific OS, architecture or a
|
||||
combination of both.
|
||||
On a mismatch, the task or command will be skipped, and no error will be thrown.
|
||||
|
||||
The values allowed as OS or Arch are valid `GOOS` and `GOARCH` values, as
|
||||
defined by the Go language
|
||||
[here](https://github.com/golang/go/blob/master/src/go/build/syslist.go).
|
||||
|
||||
The `build-windows` task below will run only on Windows, and on any architecture:
|
||||
|
||||
@@ -454,7 +459,7 @@ tasks:
|
||||
build-windows:
|
||||
platforms: [windows]
|
||||
cmds:
|
||||
- echo 'Running command on windows'
|
||||
- echo 'Running command on Windows'
|
||||
```
|
||||
|
||||
This can be restricted to a specific architecture as follows:
|
||||
@@ -466,7 +471,7 @@ tasks:
|
||||
build-windows-amd64:
|
||||
platforms: [windows/amd64]
|
||||
cmds:
|
||||
- echo 'Running command on windows (amd64)'
|
||||
- echo 'Running command on Windows (amd64)'
|
||||
```
|
||||
|
||||
It is also possible to restrict the task to specific architectures:
|
||||
@@ -487,10 +492,10 @@ Multiple platforms can be specified as follows:
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
build-windows:
|
||||
build:
|
||||
platforms: [windows/amd64, darwin]
|
||||
cmds:
|
||||
- echo 'Running command on windows (amd64) and darwin'
|
||||
- echo 'Running command on Windows (amd64) and macOS'
|
||||
```
|
||||
|
||||
Individual commands can also be restricted to specific platforms:
|
||||
@@ -499,9 +504,9 @@ Individual commands can also be restricted to specific platforms:
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
build-windows:
|
||||
build:
|
||||
cmds:
|
||||
- cmd: echo 'Running command on windows (amd64) and darwin'
|
||||
- cmd: echo 'Running command on Windows (amd64) and macOS'
|
||||
platforms: [windows/amd64, darwin]
|
||||
- cmd: echo 'Running on all platforms'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user