b131b82c21
GitHub Actions workflows: 1. CI/CD Pipeline (ci-cd.yml) - Automated testing (Python 3.11, 3.12) - Code linting (black, isort, flake8) - Docker image build - Staging/Production deployment - Code coverage reporting 2. Security Scan (security.yml) - Dependency vulnerability check (safety) - Security linting (bandit) - Weekly scheduled scans - Dependency review for PRs 3. Release (release.yml) - Automated release creation - Docker image build and push - Semantic versioning tags Features: - ✅ Multi-Python version testing - ✅ Pip package caching - ✅ Code coverage with Codecov - ✅ Security scanning - ✅ Automated deployments - ✅ Docker Hub integration Phase 4 Tasks 61-62 completed (88.2% → 91.2%)!
75 lines
1.8 KiB
YAML
75 lines
1.8 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
create-release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Generate changelog
|
|
id: changelog
|
|
run: |
|
|
# Extract changelog for this version
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create Release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: Release ${{ steps.changelog.outputs.version }}
|
|
body: |
|
|
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.
|
|
draft: false
|
|
prerelease: false
|
|
|
|
build-and-push:
|
|
name: Build and Push Docker Image
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: xiaoxia/saas
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=raw,value=latest
|
|
|
|
- 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
|