Slide 1

Slide 1 text

How to build a GitHub Action

Slide 2

Slide 2 text

About GitHub Actions (consumer side) • CI/CD • 4 runners • macOS, Windows, Linux and self hosted • Run on real machines • There is pre installed software • There are environment variables • There is also a ready-to-use GitHub Token • Full acces to the GitHub API via the Context (and more!)

Slide 3

Slide 3 text

BUT This talk is not about GitHub Actions from the consumer side

Slide 4

Slide 4 text

BUT This talk is about GitHub Actions from the developer side

Slide 5

Slide 5 text

What?! Consumer: Developer:

Slide 6

Slide 6 text

Build an Action Source

Slide 7

Slide 7 text

Build an Action • “Native” with JavaScript or Docker container • JS is • faster • runs on all runners • not that flexible than a Docker container • Docker is • slower • runs only on Linux runners (shouldn’t be a problem, right?) • 100 percent flexible

Slide 8

Slide 8 text

Build an Action – Where? • Own repository or inside your project repository in .github/actions/[nameOfAction]/ • Own repository is reuseable

Slide 9

Slide 9 text

Build an Action – Version! • commit -> author/repo-name@745bc508 • tag -> author/[email protected] • branch -> author/repo-name@master • Actions in your project repository don’t require this of course

Slide 10

Slide 10 text

Build a Docker Action Source

Slide 11

Slide 11 text

Build a Docker Action • Createa a Dockerfile • Requires a ENTRYPOINT • Create a Action Metadata file • (More about this later) • Write the Actions code in the entrypoint

Slide 12

Slide 12 text

Build a JavaScript Action Source

Slide 13

Slide 13 text

Build a JavaScript Action • Create a Action Metadata file • (More about this later) • Install Action toolskits • npm install @actions/core • npm install @actions/github • Write the Action code in a file called index.js

Slide 14

Slide 14 text

The Action Metadata file Source

Slide 15

Slide 15 text

The Action Metadata file • Describes the Action • inputs, outputs, runs (commands), ...

Slide 16

Slide 16 text

The Action Metadata file - Input • The (maybe required) input for the Action to run

Slide 17

Slide 17 text

The Action Metadata file - Input • The (maybe required) input for the Action to run

Slide 18

Slide 18 text

The Action Metadata file - Output • The (maybe) output of the Action • An Action assembles an Android Project. The output is the apk/aab. • The output can be used with the expression syntax

Slide 19

Slide 19 text

The Action Metadata file - Run • Run describes how the Action should be run. Docker or JavaScript • Docker: JS: Dockerfile or any public Docker image

Slide 20

Slide 20 text

Want an example? https://github.com/Blackjacx/backlog-notifier