GitHub Actions

Set up GitHub Actions

https://docs.github.com/en/actions/quickstart

  1. Create the necessary directories in your project

    mkdir -p .github/workflows
    
  2. Create the new workflow file

    touch .github/workflows/ci.yml
    
  3. Populate the workflow file with one of the starter workflows

  4. (Optional) Create a badge in your readme

    Follow this pattern:

    [![CI](https://github.com/USER/REPOSITORY/workflows/WORKFLOW_NAME/badge.svg)](https://github.com/USER/REPOSITORY/actions)
    
    • Replace USER and REPOSITORY as necessary
    • Replace WORKFLOW_NAME with the exact value you used for name in the workflow file, e.g. CI
      • Note that this is case-sensitive

    e.g.

    [![CI](https://github.com/bmaupin/devops-cheatsheets/workflows/CI/badge.svg)](https://github.com/bmaupin/devops-cheatsheets/actions)
    

Skip CI

Add [skip ci] to the commit message

Jobs

Run an executable file in the repo

Prefix it with ./, e.g.

- name: Build
  run: ./build.sh

Run multiple commands in a step

Use a pipe, e.g.

run: |
  wget https://github.com/IDPF/epubcheck/releases/download/v${EPUBCHECK_VERSION}/epubcheck-${EPUBCHECK_VERSION}.zip
  unzip epubcheck-${EPUBCHECK_VERSION}.zip