Github Actions

Deploying apps on the fly

Seiji Villafranca

github.com/SeijiV13

seijivillafranca.com

Seiji Villafranca

github.com/SeijiV13

Senior Developer, Wypoon Technologies Netherlands

Microsoft MVP

Auth0 Ambassador

Community Lead, AngularPH,

Author

seijivillafranca.com

Talks

Github Actions

Automate your workflow
from idea to production

Github Actions

continuous integration and continuous delivery (CI/CD) platform

Automates

Build

Test

Deployment

Github Actions

Provides Linux, Windows, and macOS virtual machines to run workflows

Flow overview

Github Actions

Code changes

Pull request

(feature branch)

Master

Test

Build

Deploy

Test

Build

Deploy

Github Actions

Components

Workflows

Events

Jobs

Actions

Runners

Workflows

Run one or more jobs.

Defined by a YAML file

Defined in

.github/workflows

workflow 1

workflow 2

Multiple workflows

workflow 3

build and test pull requests

deploy application

adds label when issue is created

Workflows

Example Workflow

name: Build, Test and Deploy
run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }}
on:
  push:
    branches:
      - main
      - 'releases/**'

Events

specific activity in a repository that triggers a workflow run

push

pull request

issues

fork

Jobs

set of steps in a workflow

Shell script that will be executed, or an action that will be run

configure a job's dependencies with other jobs

Build job

Test Job (needs the build file from build job

Jobs

Example Jobs syntax

jobs:
  job1:
  job2:
    needs: job1
  job3:
    needs: [job1, job2]

Actions

Custom application for the GitHub Actions platform that performs a repeated task 

Custom or Github Marketplace

Actions

The metadata filename must be either action.yml or action.yaml or

Type Operating system
Docker container Linux
JavaScript Linux, macOS, Windows
Composite Actions Linux, macOS, Windows

Actions

Marketplace

Github Actions Alerts

Deploy Github pages site

Github Actions Linting

Actions

Example Action

name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
  who-to-greet:  # id of input
    description: 'Who to greet'
    required: true
    default: 'World'
outputs:
  time: # id of output
    description: 'The time we greeted you'
runs:
  using: 'node16'
  main: 'index.js'

Runners

Runs your workflows when they're triggered.

GitHub provides Ubuntu Linux, Microsoft Windows, and macOS runners

Runners varies based on specific requirements (hardware configuration and operating system)

on: [push]

jobs:
  hello_world_job:
    runs-on: ubuntu-latest
    name: A job to say hello
    steps:
      - name: Hello world action step
        id: hello
        uses: octocat/hello-world-javascript-action@v1.1
        with:
          who-to-greet: 'Mona the Octocat'
      # Use the output from the `hello` step
      - name: Get the output time
        run: echo "The time was ${{ steps.hello.outputs.time }}"

A Quick Demo!

Github Actions

Hey I'm a Mentor!

github.com/SeijiV13

seijivillafranca.com

fb.com/seiji.villafranca

Thank you

and happy coding!

Runners

Larger Runners

Github Actions: Deploying apps on the fly

By Seiji Ralph Villafranca

Github Actions: Deploying apps on the fly

  • 85