[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-af9659a9-2781-409d-8877-5c452c9f9d67":3,"$fWaFyARSYH7OK4trMagb9C_fZ2ZbI3V1RVz0hwZiVla0":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"af9659a9-2781-409d-8877-5c452c9f9d67","github-actions-templates","适用于测试、构建和部署应用程序的GitHub Actions工作流程模式。","cat_life_career","mod_other","sickn33,other","---\nname: github-actions-templates\ndescription: \"Production-ready GitHub Actions workflow patterns for testing, building, and deploying applications.\"\nrisk: critical\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# GitHub Actions Templates\n\nProduction-ready GitHub Actions workflow patterns for testing, building, and deploying applications.\n\n## Do not use this skill when\n\n- The task is unrelated to github actions templates\n- You need a different domain or tool outside this scope\n\n## Instructions\n\n- Clarify goals, constraints, and required inputs.\n- Apply relevant best practices and validate outcomes.\n- Provide actionable steps and verification.\n- If detailed examples are required, open `resources\u002Fimplementation-playbook.md`.\n\n## Purpose\n\nCreate efficient, secure GitHub Actions workflows for continuous integration and deployment across various tech stacks.\n\n## Use this skill when\n\n- Automate testing and deployment\n- Build Docker images and push to registries\n- Deploy to Kubernetes clusters\n- Run security scans\n- Implement matrix builds for multiple environments\n\n## Common Workflow Patterns\n\n### Pattern 1: Test Workflow\n\n```yaml\nname: Test\n\non:\n  push:\n    branches: [ main, develop ]\n  pull_request:\n    branches: [ main ]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n\n    strategy:\n      matrix:\n        node-version: [18.x, 20.x]\n\n    steps:\n    - uses: actions\u002Fcheckout@v4\n\n    - name: Use Node.js ${{ matrix.node-version }}\n      uses: actions\u002Fsetup-node@v4\n      with:\n        node-version: ${{ matrix.node-version }}\n        cache: 'npm'\n\n    - name: Install dependencies\n      run: npm ci\n\n    - name: Run linter\n      run: npm run lint\n\n    - name: Run tests\n      run: npm test\n\n    - name: Upload coverage\n      uses: codecov\u002Fcodecov-action@v3\n      with:\n        files: .\u002Fcoverage\u002Flcov.info\n```\n\n**Reference:** See `assets\u002Ftest-workflow.yml`\n\n### Pattern 2: Build and Push Docker Image\n\n```yaml\nname: Build and Push\n\non:\n  push:\n    branches: [ main ]\n    tags: [ 'v*' ]\n\nenv:\n  REGISTRY: ghcr.io\n  IMAGE_NAME: ${{ github.repository }}\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      packages: write\n\n    steps:\n    - uses: actions\u002Fcheckout@v4\n\n    - name: Log in to Container Registry\n      uses: docker\u002Flogin-action@v3\n      with:\n        registry: ${{ env.REGISTRY }}\n        username: ${{ github.actor }}\n        password: ${{ secrets.GITHUB_TOKEN }}\n\n    - name: Extract metadata\n      id: meta\n      uses: docker\u002Fmetadata-action@v5\n      with:\n        images: ${{ env.REGISTRY }}\u002F${{ env.IMAGE_NAME }}\n        tags: |\n          type=ref,event=branch\n          type=ref,event=pr\n          type=semver,pattern={{version}}\n          type=semver,pattern={{major}}.{{minor}}\n\n    - name: Build and push\n      uses: docker\u002Fbuild-push-action@v5\n      with:\n        context: .\n        push: true\n        tags: ${{ steps.meta.outputs.tags }}\n        labels: ${{ steps.meta.outputs.labels }}\n        cache-from: type=gha\n        cache-to: type=gha,mode=max\n```\n\n**Reference:** See `assets\u002Fdeploy-workflow.yml`\n\n### Pattern 3: Deploy to Kubernetes\n\n```yaml\nname: Deploy to Kubernetes\n\non:\n  push:\n    branches: [ main ]\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions\u002Fcheckout@v4\n\n    - name: Configure AWS credentials\n      uses: aws-actions\u002Fconfigure-aws-credentials@v4\n      with:\n        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}\n        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}\n        aws-region: us-west-2\n\n    - name: Update kubeconfig\n      run: |\n        aws eks update-kubeconfig --name production-cluster --region us-west-2\n\n    - name: Deploy to Kubernetes\n      run: |\n        kubectl apply -f k8s\u002F\n        kubectl rollout status deployment\u002Fmy-app -n production\n        kubectl get services -n production\n\n    - name: Verify deployment\n      run: |\n        kubectl get pods -n production\n        kubectl describe deployment my-app -n production\n```\n\n### Pattern 4: Matrix Build\n\n```yaml\nname: Matrix Build\n\non: [push, pull_request]\n\njobs:\n  build:\n    runs-on: ${{ matrix.os }}\n\n    strategy:\n      matrix:\n        os: [ubuntu-latest, macos-latest, windows-latest]\n        python-version: ['3.9', '3.10', '3.11', '3.12']\n\n    steps:\n    - uses: actions\u002Fcheckout@v4\n\n    - name: Set up Python\n      uses: actions\u002Fsetup-python@v5\n      with:\n        python-version: ${{ matrix.python-version }}\n\n    - name: Install dependencies\n      run: |\n        python -m pip install --upgrade pip\n        pip install -r requirements.txt\n\n    - name: Run tests\n      run: pytest\n```\n\n**Reference:** See `assets\u002Fmatrix-build.yml`\n\n## Workflow Best Practices\n\n1. **Use specific action versions** (@v4, not @latest)\n2. **Cache dependencies** to speed up builds\n3. **Use secrets** for sensitive data\n4. **Implement status checks** on PRs\n5. **Use matrix builds** for multi-version testing\n6. **Set appropriate permissions**\n7. **Use reusable workflows** for common patterns\n8. **Implement approval gates** for production\n9. **Add notification steps** for failures\n10. **Use self-hosted runners** for sensitive workloads\n\n## Reusable Workflows\n\n```yaml\n# .github\u002Fworkflows\u002Freusable-test.yml\nname: Reusable Test Workflow\n\non:\n  workflow_call:\n    inputs:\n      node-version:\n        required: true\n        type: string\n    secrets:\n      NPM_TOKEN:\n        required: true\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions\u002Fcheckout@v4\n    - uses: actions\u002Fsetup-node@v4\n      with:\n        node-version: ${{ inputs.node-version }}\n    - run: npm ci\n    - run: npm test\n```\n\n**Use reusable workflow:**\n```yaml\njobs:\n  call-test:\n    uses: .\u002F.github\u002Fworkflows\u002Freusable-test.yml\n    with:\n      node-version: '20.x'\n    secrets:\n      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}\n```\n\n## Security Scanning\n\n```yaml\nname: Security Scan\n\non:\n  push:\n    branches: [ main ]\n  pull_request:\n    branches: [ main ]\n\njobs:\n  security:\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions\u002Fcheckout@v4\n\n    - name: Run Trivy vulnerability scanner\n      uses: aquasecurity\u002Ftrivy-action@master\n      with:\n        scan-type: 'fs'\n        scan-ref: '.'\n        format: 'sarif'\n        output: 'trivy-results.sarif'\n\n    - name: Upload Trivy results to GitHub Security\n      uses: github\u002Fcodeql-action\u002Fupload-sarif@v2\n      with:\n        sarif_file: 'trivy-results.sarif'\n\n    - name: Run Snyk Security Scan\n      uses: snyk\u002Factions\u002Fnode@master\n      env:\n        SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}\n```\n\n## Deployment with Approvals\n\n```yaml\nname: Deploy to Production\n\non:\n  push:\n    tags: [ 'v*' ]\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    environment:\n      name: production\n      url: https:\u002F\u002Fapp.example.com\n\n    steps:\n    - uses: actions\u002Fcheckout@v4\n\n    - name: Deploy application\n      run: |\n        echo \"Deploying to production...\"\n        # Deployment commands here\n\n    - name: Notify Slack\n      if: success()\n      uses: slackapi\u002Fslack-github-action@v1\n      with:\n        webhook-url: ${{ secrets.SLACK_WEBHOOK }}\n        payload: |\n          {\n            \"text\": \"Deployment to production completed successfully!\"\n          }\n```\n\n## Reference Files\n\n- `assets\u002Ftest-workflow.yml` - Testing workflow template\n- `assets\u002Fdeploy-workflow.yml` - Deployment workflow template\n- `assets\u002Fmatrix-build.yml` - Matrix build template\n- `references\u002Fcommon-workflows.md` - Common workflow patterns\n\n## Related Skills\n\n- `gitlab-ci-patterns` - For GitLab CI workflows\n- `deployment-pipeline-design` - For pipeline architecture\n- `secrets-management` - For secrets handling\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,225,1055,"2026-05-16 13:20:27",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"其他","other","mdi-page-next-outline","其他类型Skill",5,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"职场发展","career","mdi-briefcase-outline","面试准备、简历优化、职业规划",4,575,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"18800fd6-3c9d-42bb-9f8e-d65ca0ca896d","1.0.0","github-actions-templates.zip",2809,"uploads\u002Fskills\u002Faf9659a9-2781-409d-8877-5c452c9f9d67\u002Fgithub-actions-templates.zip","de5812f8c16919f8f0a735c16668c33e97a58aec4a25f3f3a73b6e13fd2feaf8","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":7919}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]