Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

2020.10.29

Blank

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Runs a single command using the runners shell
      - name: Run a one-line script
        run: echo Hello, world!

      # Runs a set of commands using the runners shell
      - name: Run a multi-line script
        run: |
          echo Add other actions to build,
          echo test, and deploy your project.

Environment variables

name: Matrix environment variables

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        fruit:
          - Apple
          - Banana
        meal:
          - Breakfast
          - Lunch
    steps:
    - name: Single step
      env:
         DEMO_FRUIT: ${{ matrix.fruit }}
         DEMO_MEAL:  ${{ matrix.meal }}
      run: |
        echo $DEMO_FRUIT for $DEMO_MEAL

Linux

name: Minimal Ubuntu

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Single step
      run: echo Hello World

    - name: Look around
      run: |
        uname -a
        pwd     # /home/runner/work/REPO/REPO
        whoami  # runner
        uptime
        which perl
        which python
        which python3
        which ruby
        which node
        which java
        perl -v
        python -V
        python3 -V
        ruby -v
        node -v
        javac -version
        java -version

macOS

name: Minimal MacOS

on: push

jobs:
  build:
    runs-on: macos-latest
    steps:
    - name: Single step
      run: echo Hello World

    - name: Look around
      run: |
        uname -a
        pwd
        whoami
        uptime
        which perl
        which python
        which python3
        which ruby
        which node
        which java
        perl -v
        python -V
        python3 -V
        ruby -v
        node -v
        javac -version
        java -version

Windows

name: Minimal Windows

on: push

jobs:
  build:
    runs-on: windows-latest
    steps:
    - name: Single step
      run: echo Hello World

    - name: Look around
      run: |
        uname -a
        pwd
        whoami
        uptime
        which perl
        which python
        #which python3
        which ruby
        which node
        which java
        perl -v
        python -V    # 3.7.9
        #python3 -V
        ruby -v
        node -v
        javac -version
        java -version

repository