_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

GitHub Actions — Pokročilé Workflow

27. 02. 2023 1 min read intermediate

DevOps Intermediate

GitHub Actions — Pokročilé Workflow

GitHub ActionsCI/CDAutomatizace 6 min read

Pokročilé techniky GitHub Actions: matrix builds, reusable workflows, composite actions a self-hosted runners.

Matrix Builds

Matrix strategie umožňuje paralelní běh testů napříč verzemi a platformami.

jobs:
  test:
    strategy:
      matrix:
        node: [18, 20, 22]
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci && npm test

Reusable Workflows

Sdílení workflow napříč repozitáři eliminuje duplicitu. Definujte workflow v centrálním repu a volte ho přes workflow_call.

on:
  workflow_call:
    inputs:
      environment:
        required: true
        type: string
    secrets:
      DEPLOY_KEY:
        required: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: ${{ inputs.environment }}
    steps:
      - uses: actions/checkout@v4
      - run: ./deploy.sh
        env:
          KEY: ${{ secrets.DEPLOY_KEY }}

Composite Actions

Composite actions kombinují více kroků do jedné znovupoužitelné akce s vlastními vstupy a výstupy.

name: Build and Push
inputs:
  image:
    required: true
runs:
  using: composite
  steps:
    - run: docker build -t ${{ inputs.image }} .
      shell: bash
    - run: docker push ${{ inputs.image }}
      shell: bash

Self-hosted Runners

Pro specifické HW požadavky nebo privátní sítě nasaďte vlastní runner. Použijte actions-runner-controller pro Kubernetes-native scaling.

apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
  name: k8s-runners
spec:
  replicas: 3
  template:
    spec:
      repository: org/repo
      labels:
        - self-hosted
        - linux

Summary

GitHub Actions je extrémně flexibilní CI/CD platforma. Matrix builds, reusable workflows a composite actions dramaticky snižují duplicitu a zrychlují feedback loop.

Need Help with Implementation?

Our team has experience designing and implementing modern architectures. We’re happy to help.

Free Consultation

Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.