Contents

Github Actions: Hello World

Hello World Steps

  1. Add a Dockerfile
  2. Add an entrypoint script
  3. Add an action.yml file
  4. Start workflow file
  5. Run an action from workflow file
  6. Trigger the workflow
  7. Incorporate the workflow

Possible usages:

  1. Automated testing (CI)
  2. Continuous delivery and deployment
  3. Responding to workflow triggers using issues, @ mentions, labels, and more
  4. Triggering code reviews
  5. Managing branches
  6. Triaging issues and pull requests

Actions and Workflows: workflow can contain many actions. each action has a purpose

Types of Actions:

  1. Container actions: can only execute in Github-hosted Linux environment
  2. 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:

  1. name/description/author
  2. inputs-environment variables w/ defaults
  3. runs Dockerfile
  4. 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:

  1. within same repo
  2. other public repo
  3. 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