Github Actions: Hello World
Contents
Hello World Steps
- Add a Dockerfile
- Add an entrypoint script
- Add an action.yml file
- Start workflow file
- Run an action from workflow file
- Trigger the workflow
- Incorporate the workflow
Possible usages:
- Automated testing (CI)
- Continuous delivery and deployment
- Responding to workflow triggers using issues, @ mentions, labels, and more
- Triggering code reviews
- Managing branches
- Triaging issues and pull requests
Actions and Workflows: workflow can contain many actions. each action has a purpose
Types of Actions:
- Container actions: can only execute in Github-hosted Linux environment
- Javascript actions: faster execution decoupled from environment; greater dependency management responsibility.
Step 3: action.yml file
All actions need a metadata file in YAML with:
- name/description/author
- inputs-environment variables w/ defaults
- runs Dockerfile
- branding ??
Step 4: workflow file
- main.yml in
.github/workflows
directory - execute based on chosen event (push, etc)
Workflows ( jobs ( steps ))
Step 5: workflow action block
Actions can be used from:
- within same repo
- other public repo
- published Docker container image
action block components:
- jobs: base component of a workflow run
- build: identifier for this job
- name: displayed when runs
- runs-on: machine/runner for job [github/self-hosted]
- steps: sequence of operations that make up the job
- uses: actions/checkout@v1 : uses community action called
checkout
to allow workflow to access the contents of the repo - uses: ./action-a : path to the action created
- with: specify input variables available to action in runtime environment