CI/CD Workflow Examples
Real-world workflow templates using P6M Actions
Complete, copy-paste workflow examples that demonstrate best practices for different technology stacks using the P6M Actions Repository.
Quick Start Templates
Basic Setup → Build → Publish Pattern
name: Build and Publish
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup (choose your stack)
- uses: p6m-actions/js-pnpm-setup@v1 # JavaScript
# - uses: p6m-actions/python-poetry-setup@v1 # Python
# - uses: p6m-actions/docker-buildx-setup@v1 # Docker
# Build and Test
- uses: p6m-actions/js-pnpm-build@v1 # JavaScript
- uses: p6m-actions/dotnet-build@v1 # .NET (includes setup+build)
# Authenticate (only on main branch)
- if: github.ref == 'refs/heads/main'
uses: p6m-actions/dotnet-repository-login@v1 # .NET
# uses: p6m-actions/python-poetry-login@v1 # Python
# uses: p6m-actions/rust-registry-login@v1 # Rust
# uses: p6m-actions/docker-repository-login@v1 # Docker
# Publish (only on main branch)
- if: github.ref == 'refs/heads/main'
uses: p6m-actions/dotnet-repository-publish@v1 # .NET
# uses: p6m-actions/rust-registry-publish@v1 # Rust
# uses: p6m-actions/js-pnpm-docker-build-publish@v1 # JS+Docker
# Platform Integration (Kubernetes deployment)
- if: github.ref == 'refs/heads/main'
uses: p6m-actions/platform-application-manifest-dispatch@v1
🏢 Technology-Specific Examples
Complete workflow for .NET web applications with NuGet package publishing and Docker deployment.
Poetry-based Python service with PyPI publishing and containerized deployment workflow.
PNPM-optimized workflow for Next.js applications with container publishing and Kubernetes deployment.
Advanced workflow for repositories containing multiple technology stacks with intelligent change detection.
.NET Web API Example
Complete workflow for a .NET Web API with NuGet publishing:
name: .NET Web API CI/CD
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
DOTNET_VERSION: '8.0.x'
PROJECT_PATH: './src/MyWebApi'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# .NET build action includes setup, build, test, and coverage
- uses: p6m-actions/dotnet-build@v1
with:
project-path: ${{ env.PROJECT_PATH }}
dotnet-version: ${{ env.DOTNET_VERSION }}
configuration: Release
publish-package:
if: github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/dotnet-repository-login@v1
with:
registry-url: ${{ vars.NUGET_REGISTRY_URL }}
username: ${{ vars.NUGET_USERNAME }}
password: ${{ secrets.NUGET_TOKEN }}
- uses: p6m-actions/dotnet-repository-publish@v1
with:
project-path: ${{ env.PROJECT_PATH }}
version-suffix: ${{ github.run_number }}
deploy-container:
if: github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/docker-buildx-setup@v1
- uses: p6m-actions/docker-repository-login@v1
with:
registry: ${{ vars.CONTAINER_REGISTRY }}
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
# Build and push Docker image (manual step)
- name: Build and push
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag ${{ vars.CONTAINER_REGISTRY }}/mywebapi:${{ github.sha }} \
--push .
- uses: p6m-actions/platform-application-manifest-dispatch@v1
with:
image-tag: ${{ github.sha }}
manifest-repo: my-org/k8s-manifests
Python FastAPI Example
Poetry-based Python service with containerized deployment:
name: Python FastAPI CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
PYTHON_VERSION: '3.11'
SERVICE_NAME: 'fastapi-service'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/python-poetry-setup@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
# Manual build step (Poetry handles this)
- name: Install dependencies and test
run: |
poetry install
poetry run pytest
poetry run black --check .
poetry run flake8
publish-package:
if: github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/python-poetry-setup@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: p6m-actions/python-poetry-login@v1
with:
registry-url: ${{ vars.PYPI_REGISTRY_URL }}
username: ${{ vars.PYPI_USERNAME }}
password: ${{ secrets.PYPI_TOKEN }}
- name: Build and publish
run: |
poetry build
poetry publish
deploy-container:
if: github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/docker-buildx-setup@v1
- uses: p6m-actions/docker-repository-login@v1
with:
registry: ${{ vars.CONTAINER_REGISTRY }}
- name: Build and push
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag ${{ vars.CONTAINER_REGISTRY }}/${{ env.SERVICE_NAME }}:${{ github.sha }} \
--push .
- uses: p6m-actions/platform-application-manifest-dispatch@v1
with:
image-tag: ${{ github.sha }}
service-name: ${{ env.SERVICE_NAME }}
Next.js Application Example
PNPM-optimized workflow for Next.js applications:
name: Next.js Application CI/CD
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
NODE_VERSION: '20'
APP_NAME: 'my-nextjs-app'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/js-pnpm-setup@v1
with:
node-version: ${{ env.NODE_VERSION }}
- uses: p6m-actions/js-pnpm-build@v1
with:
build-command: 'build'
test-command: 'test:ci'
deploy-container:
if: github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/js-pnpm-setup@v1
with:
node-version: ${{ env.NODE_VERSION }}
- uses: p6m-actions/js-pnpm-docker-build-publish@v1
with:
image-name: ${{ env.APP_NAME }}
registry: ${{ vars.CONTAINER_REGISTRY }}
- uses: p6m-actions/platform-application-manifest-dispatch@v1
with:
image-tag: ${{ github.sha }}
service-name: ${{ env.APP_NAME }}
Multi-Stack Monorepo Example
Advanced workflow for repositories with multiple technology stacks:
name: Multi-Stack Monorepo CI/CD
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
dotnet: ${{ steps.changes.outputs.dotnet }}
python: ${{ steps.changes.outputs.python }}
javascript: ${{ steps.changes.outputs.javascript }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
dotnet:
- 'services/dotnet/**'
- 'shared/dotnet/**'
python:
- 'services/python/**'
- 'shared/python/**'
javascript:
- 'apps/web/**'
- 'packages/**'
test-dotnet:
if: needs.detect-changes.outputs.dotnet == 'true'
needs: detect-changes
runs-on: ubuntu-latest
strategy:
matrix:
service: [user-api, payment-service]
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/dotnet-build@v1
with:
project-path: ./services/dotnet/${{ matrix.service }}
test-python:
if: needs.detect-changes.outputs.python == 'true'
needs: detect-changes
runs-on: ubuntu-latest
strategy:
matrix:
service: [analytics-api, notification-service]
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/python-poetry-setup@v1
with:
python-version: '3.11'
- name: Test Python service
run: |
cd ./services/python/${{ matrix.service }}
poetry install
poetry run pytest
test-javascript:
if: needs.detect-changes.outputs.javascript == 'true'
needs: detect-changes
runs-on: ubuntu-latest
strategy:
matrix:
app: [admin-dashboard, customer-portal]
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/js-pnpm-setup@v1
with:
node-version: '20'
- uses: p6m-actions/js-pnpm-build@v1
with:
working-directory: ./apps/web/${{ matrix.app }}
Additional Resources
Browse our complete library of reusable GitHub Actions with detailed documentation.
Resolve common issues and optimize your CI/CD workflows.