Watch this Tech Talk: https://do.co/video_karanmv
Find yourself juggling between different tools in your software development & deployment workflow? Karan MV, Developer Relations Professional for GitHub India, provides tips to simplify your workflow using GitHub Actions and DigitialOcean's APIs. Watch as he concludes with a demo of running a CI/CD pipeline to deploy on DigitalOcean.
About the Presenter
Karan MV currently manages developer relations for GitHub India. When he is not working, you can find him reading books of various genres, studying filmmaking, and honing his acting and stage-anchoring skills.
New to DigitalOcean? Get US $100 in credit when you sign up: https://do.co/deploytoday
To learn more about DigitalOcean: https://www.digitalocean.com/
Follow us on Twitter: https://twitter.com/digitalocean
Like us on Facebook: https://www.facebook.com/DigitalOcean
Follow us on Instagram: https://www.instagram.com/thedigitalocean/
We're hiring: http://do.co/careers
7. Actions are reusable
components
● Live in independent repositories
○ Public repositories for now
○ Official list: https://github/actions
● Written in JavaScript (node12)
○ May use GitHub Actions Toolkit JS for
command line argument parsing, passing
parameters, interacting with the GitHub
API
● Or Docker
○ Similar to beta 1 actions, but with updated
syntax & argument passing
○ Or point to existing actions published to
Docker Hub
1
2
8. Workflows
Workflow files glue together existing actions
● Listen for particular triggers
● Then run shell scripts
● Or pre-existing actions
● Actions run in VMs (Linux, Win, Mac)
○ Or Docker on Linux VM
1
2
3
9. Stuff to keep in mind
re Workflows
● Events kick off the workflow
● Jobs run each in their own VM
○ In parallel (unless the
workflow says otherwise)
○ Job specifies the VM
Linux/Windows/MacOS
● Steps run in the same VM
○ Share filesystem
● Logs are searchable, link to
individual lines
○ Artifacts can be saved
10. A Java + Maven
basic CI workflow
● A single job, with 5 steps
● Runs directly on the VM
○ Ubuntu in this case
● Actions are composable
○ Checkout is separate
○ Setup for most languages in
github.com/actions
○ Maven run by shell
○ Artifact uploaded separately
1
2
3
4
11. Event triggers
`on: push`
Complete reference in the docs:
https://help.github.com/en/articles/e
vents-that-trigger-workflows
Listen for multiple events:
on: [push, pull_request]
Qualify these as needed:
on:
create:
ref_type: tag
Or for a branch:
on:
push:
branches:
- master
paths:
- 'test/*'
Schedule with cron synax:
on:
schedule:
- cron: '*/15 * * * *'
12. Steps: Where the
magic happens
Complete reference in the docs:
help.github.com/en/articles/configuri
ng-a-workflow
Run other actions:
steps:
- uses: actions/checkout@v1
with:
ref: staging-branch
Or command line scripts:
- name: Build with Maven
run: mvn package -DskipTests
Even multi-line scripts:
- name: Test with Maven
run: |
mvn test
echo Testing separately
17. Example application
● Open MCT (Open Mission Control
Technologies) is a mission control
framework for visualization of data
on desktop and mobile devices.
● NodeJS app
● Open source under Apache 2.0
License
● Dockerized it for this demo
● github.com/nasa/openmct-tutorial