Listen to this Post

Using automation tools like GitHub Actions and workflows can greatly simplify your DevOps life. Automating processes ensures they run consistently and on schedule. Reusing workflows across repositories improves maintainability and reduces redundancy.
Alex Aslam demonstrates advanced techniques for GitHub Actions, including reusable workflows and matrix jobs, which allow testing different combinations of configurations efficiently.
You Should Know:
1. Reusable Workflows
Reusable workflows allow you to define a workflow once and reference it across multiple repositories.
Example Workflow (`.github/workflows/reusable.yml`)
name: Reusable CI
on:
workflow_call:
inputs:
node-version:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
- run: npm install
- run: npm test
Calling the Reusable Workflow
name: Main Workflow on: [bash] jobs: call-reusable: uses: ./.github/workflows/reusable.yml with: node-version: '18.x'
2. Matrix Jobs for Parallel Testing
Matrix jobs allow running the same workflow with different configurations (e.g., OS, Node versions).
Matrix Example
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
3. Custom Automation with GitHub Actions
Automate deployments, notifications, and security checks.
Auto-Deploy to AWS S3
name: Deploy to S3
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Deploy to S3
run: |
aws s3 sync ./dist s3://your-bucket-name --delete
What Undercode Say:
GitHub Actions revolutionizes CI/CD by enabling reusable workflows, matrix-based testing, and custom automation. Key takeaways:
– Reuse workflows to avoid duplication.
– Matrix jobs save time by parallelizing tests.
– Automate deployments securely using secrets.
Bonus Linux & Windows Commands for DevOps:
Linux:
Monitor GitHub Actions logs in real-time journalctl -u actions-runner -f Clean up old Docker containers docker system prune -a -f Check disk space for CI runners df -h
Windows (PowerShell):
List running GitHub Actions runners Get-Service actions.runner. Check disk space Get-Volume | Select-Object DriveLetter, SizeRemaining, Size
Expected Output:
A fully automated CI/CD pipeline with reusable workflows, matrix testing, and secure cloud deployments.
GitHub Actions Docs
Advanced GitHub Actions Guide
References:
Reported By: Darryl Ruggles – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


