Skip to content

Latest commit

 

History

History
226 lines (153 loc) · 3.82 KB

File metadata and controls

226 lines (153 loc) · 3.82 KB

✔️ KK FUNDA — Create & Run First Workflow (Beginner Level — Only Linux Commands)

This is exactly suitable for starting-level training.


1. Creating Your First Workflow

In your repository, create this file:

.github/workflows/first.yml

Add the simplest workflow:

name: First Workflow

on:
  push:
    branches: [ main ]
  workflow_dispatch:   #runs the workflow manually

jobs:
  basic-demo:
    runs-on: ubuntu-latest

    steps:
      - name: Say Hello
        run: echo "Hello from KK FUNDA"

      - name: Show Linux version
        run: uname -a

      - name: List current directory
        run: ls -ltr

      - name: Print current user
        run: whoami

      - name: Print date and time
        run: date

Concepts Explained

  • runs-on: ubuntu-latest → GitHub provides a fresh Linux machine
  • run: → shell commands
  • Output visible in Actions logs

This is the cleanest way to start GitHub Actions teaching.


2. Opening VS Code via https://github.dev/

This is perfect for beginners.

How to open?

From any GitHub repo:

  • Press . (dot) on the keyboard OR

  • Change URL

    github.com/<user>/<repo> → github.dev/<user>/<repo>
    

You will see VS Code UI inside your browser.

Why use github.dev?

  • No installation
  • Works on mobile, laptop, office system
  • Perfect to create .github/workflows/ folder easily
  • Great for teaching beginners how to edit YAML

What to do here?

  • Create folder: .github/workflows/
  • Add YAML file: first.yml
  • Commit the file from the left menu
  • Workflow will automatically trigger

3. Installing GitHub Actions Plugin (for VS Code users)

If students use Desktop VS Code:

  1. Open VS Code

  2. Go to Extensions

  3. Search: GitHub Actions

  4. Install the official extension

  5. It provides:

    • Syntax highlighting
    • Autocomplete for YAML
    • Easy workflow navigation

Note: Some features will not work in github.dev, but syntax support works.


4. Multiple Simple Basic Workflows (Ubuntu + Linux Commands Only)

Here is the pure basics version — no projects, no code, no languages.


Workflow 1 — Print system info

name: System Info

on: [push]

jobs:
  info:
    runs-on: ubuntu-latest
    steps:
      - name: Print hostname
        run: hostname

      - name: Kernel info
        run: uname -r

      - name: Show OS info
        run: cat /etc/os-release

Workflow 2 — File and directory operations

name: File Operations

on: workflow_dispatch

jobs:
  files:
    runs-on: ubuntu-latest
    steps:
      - name: Create file
        run: echo "KK FUNDA TEST FILE" > demo.txt

      - name: Show file content
        run: cat demo.txt

      - name: List directory
        run: ls -l

Workflow 3 — Environment variables

name: Env Demo

on: [push]

jobs:
  env-demo:
    runs-on: ubuntu-latest

    steps:
      - name: Print predefined env
        run: echo "Repo Name is $GITHUB_REPOSITORY"

      - name: Set and print custom env
        run: |
          MYNAME="Prashanth"
          echo "My name is $MYNAME"

Workflow 4 — Using multiple steps with Linux commands

name: Multi-Step Demo

on: workflow_dispatch

jobs:
  demo:
    runs-on: ubuntu-latest
    steps:
      - name: Step 1 - pwd
        run: pwd

      - name: Step 2 - whoami
        run: whoami

      - name: Step 3 - System date
        run: date

      - name: Step 4 - Disk usage
        run: df -h

Workflow 5 — Simple string manipulation

name: Strings Demo

on: workflow_dispatch

jobs:
  strings:
    runs-on: ubuntu-latest
    steps:
      - name: Convert to uppercase
        run: echo "kk funda" | tr 'a-z' 'A-Z'

      - name: Word count
        run: echo "GitHub Actions Training" | wc -w