Skip to content
Back to skills

Github Actions Templates

ASecurity

Padrões de workflow GitHub Actions prontos para produção para testes, build e deployment de aplicações.

  • 11 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
devopspythonnodedockerkubernetesawsgitapisecurity

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 8, 2026

npx -y skills add artubss/SKILLS-CLAUDE-CODE --skill github-actions-templates --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Github Actions Templates?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Github Actions Templates
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/artubss-github-actions-templates/badge)](https://www.skillsdirectory.com/skills/artubss-github-actions-templates)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: github-actions-templates
description: "Padrões de workflow GitHub Actions prontos para produção para testes, build e deployment de aplicações."
risk: critical
source: community
date_added: "2026-02-27"
---

# Modelos GitHub Actions

Padrões de workflow GitHub Actions prontos para produção para testes, build e deployment de aplicações.

## Não use essa skill quando

- A tarefa é não relacionada a modelos de workflow GitHub Actions
- Você precisa de um domínio ou ferramenta diferente fora desse escopo

## Instruções

- Esclareça objetivos, restrições e entradas obrigatórias.
- Aplique as melhores práticas relevantes e valide os resultados.
- Forneça passos acionáveis e verificação.
- Se exemplos detalhados forem necessários, abra `resources/implementation-playbook.md`.

## Propósito

Criar workflows GitHub Actions eficientes e seguros para integração contínua e deployment em diversos tech stacks.

## Use essa skill quando

- Automatizar testes e deployment
- Build de imagens Docker e push para registros
- Deploy em clusters Kubernetes
- Executar scans de segurança
- Implementar matrix builds para múltiplos ambientes

## Padrões de Workflow Comuns

### Padrão 1: Workflow de Testes

```yaml
name: Test

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [18.x, 20.x]

    steps:
    - uses: actions/checkout@v4

    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'

    - name: Install dependencies
      run: npm ci

    - name: Run linter
      run: npm run lint

    - name: Run tests
      run: npm test

    - name: Upload coverage
      uses: codecov/codecov-action@v3
      with:
        files: ./coverage/lcov.info
```

**Referência:** Veja `assets/test-workflow.yml`

### Padrão 2: Build e Push de Imagem Docker

```yaml
name: Build and Push

on:
  push:
    branches: [ main ]
    tags: [ 'v*' ]

env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write

    steps:
    - uses: actions/checkout@v4

    - name: Log in to Container Registry
      uses: docker/login-action@v3
      with:
        registry: ${{ env.REGISTRY }}
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}

    - name: Extract metadata
      id: meta
      uses: docker/metadata-action@v5
      with:
        images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
        tags: |
          type=ref,event=branch
          type=ref,event=pr
          type=semver,pattern={{version}}
          type=semver,pattern={{major}}.{{minor}}

    - name: Build and push
      uses: docker/build-push-action@v5
      with:
        context: .
        push: true
        tags: ${{ steps.meta.outputs.tags }}
        labels: ${{ steps.meta.outputs.labels }}
        cache-from: type=gha
        cache-to: type=gha,mode=max
```

**Referência:** Veja `assets/deploy-workflow.yml`

### Padrão 3: Deploy em Kubernetes

```yaml
name: Deploy to Kubernetes

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@v4
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: us-west-2

    - name: Update kubeconfig
      run: |
        aws eks update-kubeconfig --name production-cluster --region us-west-2

    - name: Deploy to Kubernetes
      run: |
        kubectl apply -f k8s/
        kubectl rollout status deployment/my-app -n production
        kubectl get services -n production

    - name: Verify deployment
      run: |
        kubectl get pods -n production
        kubectl describe deployment my-app -n production
```

### Padrão 4: Matrix Build

```yaml
name: Matrix Build

on: [push, pull_request]

jobs:
  build:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        python-version: ['3.9', '3.10', '3.11', '3.12']

    steps:
    - uses: actions/checkout@v4

    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt

    - name: Run tests
      run: pytest
```

**Referência:** Veja `assets/matrix-build.yml`

## Melhores Práticas de Workflow

1. **Use versões específicas de actions** (@v4, nunca @latest)
2. **Faça cache de dependências** para acelerar builds
3. **Use secrets** para dados sensíveis
4. **Implemente verificações de status** em PRs
5. **Use matrix builds** para testes multi-versão
6. **Defina permissões apropriadas**
7. **Use workflows reutilizáveis** para padrões comuns
8. **Implemente approval gates** para produção
9. **Adicione etapas de notificação** para falhas
10. **Use runners auto-hospedados** para cargas de trabalho sensíveis

## Workflows Reutilizáveis

```yaml
# .github/workflows/reusable-test.yml
name: Reusable Test Workflow

on:
  workflow_call:
    inputs:
      node-version:
        required: true
        type: string
    secrets:
      NPM_TOKEN:
        required: true

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-node@v4
      with:
        node-version: ${{ inputs.node-version }}
    - run: npm ci
    - run: npm test
```

**Use o workflow reutilizável:**
```yaml
jobs:
  call-test:
    uses: ./.github/workflows/reusable-test.yml
    with:
      node-version: '20.x'
    secrets:
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```

## Scanning de Segurança

```yaml
name: Security Scan

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  security:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Run Trivy vulnerability scanner
      uses: aquasecurity/trivy-action@master
      with:
        scan-type: 'fs'
        scan-ref: '.'
        format: 'sarif'
        output: 'trivy-results.sarif'

    - name: Upload Trivy results to GitHub Security
      uses: github/codeql-action/upload-sarif@v2
      with:
        sarif_file: 'trivy-results.sarif'

    - name: Run Snyk Security Scan
      uses: snyk/actions/node@master
      env:
        SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
```

## Deployment com Aprovações

```yaml
name: Deploy to Production

on:
  push:
    tags: [ 'v*' ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment:
      name: production
      url: https://app.example.com

    steps:
    - uses: actions/checkout@v4

    - name: Deploy application
      run: |
        echo "Deploying to production..."
        # Deployment commands here

    - name: Notify Slack
      if: success()
      uses: slackapi/slack-github-action@v1
      with:
        webhook-url: ${{ secrets.SLACK_WEBHOOK }}
        payload: |
          {
            "text": "Deployment to production completed successfully!"
          }
```

## Arquivos de Referência

- `assets/test-workflow.yml` - Modelo de workflow de testes
- `assets/deploy-workflow.yml` - Modelo de workflow de deployment
- `assets/matrix-build.yml` - Modelo de matrix build
- `references/common-workflows.md` - Padrões de workflows comuns

## Skills Relacionadas

- `gitlab-ci-patterns` - Para workflows GitLab CI
- `deployment-pipeline-design` - Para arquitetura de pipeline
- `secrets-management` - Para gerenciamento de secrets

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…