Created
October 9, 2019 12:21
-
-
Save tboerger/d0b6cfc96d1cb1ff0a9abf18c7f2b971 to your computer and use it in GitHub Desktop.
Drone Starlark example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main(ctx): | |
| return [ | |
| pipeline(), | |
| ] | |
| def pipeline(): | |
| return { | |
| 'kind': 'pipeline', | |
| 'type': 'docker', | |
| 'name': 'linux', | |
| 'platform': { | |
| 'os': 'linux', | |
| 'arch': arch, | |
| }, | |
| 'steps': [ | |
| test(), | |
| build(), | |
| docker(), | |
| ], | |
| } | |
| def test(): | |
| return { | |
| 'name': 'test', | |
| 'image': 'golang:1.13', | |
| 'commands': [ | |
| 'go test ./...', | |
| ], | |
| } | |
| def build(): | |
| return { | |
| 'name': 'build', | |
| 'image': 'golang:1.13', | |
| 'commands': [ | |
| 'go build', | |
| ], | |
| } | |
| def docker(): | |
| return { | |
| 'name': 'publish', | |
| 'image': 'plugins/docker', | |
| 'settings': { | |
| 'auto_tag': True, | |
| 'auto_tag_suffix': 'linux-amd64', | |
| 'repo': 'octocat/hello', | |
| 'username': { | |
| 'from_secret': 'docker_username', | |
| }, | |
| 'password': { | |
| 'from_secret': 'docker_password', | |
| }, | |
| }, | |
| 'when': { | |
| 'event': [ | |
| 'push', | |
| 'tag', | |
| ], | |
| }, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment