Github Actions
A Github Action is established as soon as we have a .github/workflows
directory committed to our repo on Github.
Terminology
Workflow
A workflow is an automated procedure that exists as a part of our repo.
- Workflows are made up of a collection of jobs which run is response to some event (on PR, on push etc)
A Github Workflow can be used to build, test, package, release, or deploy a project on GitHub.
Workflows can be configured to run in response to a webhook call, so we can trigger workflows in response to events happening outside Github.
Resources
Job
A job is a set of steps that execute on a single runner
A workflow with multiple jobs will run those jobs in parallel by default (configurable)
Each job in a workflow runs in a fresh virtual environment
Step
A step is an individual task that can run commands in a job
A step can either be:
- a shell command
- an action
Each step in a job executes on the same runner, allowing the actions in that job to share data with each other.
Changing directories in one step does not carry through to the next step:
# workflow.actions.yml
- name: cd into publishable
run: |
cd publishable
pwd
- name: does the cd carry thru?
run: |
pwd
log:
Run cd publishable
/home/runner/work/Digital-Garden/Digital-Garden/publishable
Run pwd
/home/runner/work/Digital-Garden/Digital-Garden
Action
Actions are standalone commands that are combined into steps to create a job Actions are the smallest portable building block of a workflow. You can create your own actions, or use actions created by the GitHub community
For instance, we have the checkout@v2
action, which allows the runner to checkout a repo. In fact, we can checkout any SHA from any repo.
Runner
A runner is a server that has the GitHub Actions runner application installed
- meaning we could use the managed service from Github, or self-host the Runner.
A runner listens for available jobs, runs one job at a time, and reports the progress, logs, and results back to GitHub
GitHub-hosted runners are based on Ubuntu Linux, Microsoft Windows, and macOS
Secrets
GITHUB_TOKEN
is passed to the runner when a workflow is triggered.
- Aside from this, no other secrets are passed by default, and must be configured manually.
To provide an action with a secret (either as input or as an env variable), use the secrets
context.
- This allows us to access secrets we've created in our repo.
- more info
Secrets should not be passed between processes via the command line, as these commands might be visible to other users with the ps
command.
- This is why we use
STDIN
or env variables to pass secrets.
UE Resources
Children
Backlinks