Files
PaperlessMCP/.woodpecker/release.yml
T
Barry Walker 6cac693e9c feat: add k8s deployment pipeline and code quality improvements
- Add deploy step to Woodpecker CI release pipeline
- Create ParsingHelpers utility to deduplicate ParseIntArray/ParseDate
- Add ConfigureAwait(false) to all async calls (library best practice)
- Fix resource disposal in UploadDocumentInternalAsync
- Configure HttpClient default 30s timeout
- Remove unused GetAllPagesAsync method

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 18:21:00 -05:00

140 lines
4.8 KiB
YAML

# Release Pipeline - Build, test, version, package, release
when:
- event: push
branch: main
labels:
platform: linux/amd64
clone:
- name: clone
image: woodpeckerci/plugin-git
settings:
lfs: false
depth: 50
tags: true
steps:
- name: build-and-test
image: mcr.microsoft.com/dotnet/sdk:10.0
commands:
- dotnet restore
- dotnet build -c Release
- dotnet test -c Release --logger "console;verbosity=detailed"
# Determine next version based on conventional commits
- name: version
image: alpine/git
commands:
- |
set -e
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "Latest tag: $LATEST_TAG"
VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
MAJOR=$(echo "$VERSION" | cut -d. -f1)
MINOR=$(echo "$VERSION" | cut -d. -f2)
PATCH=$(echo "$VERSION" | cut -d. -f3)
echo "Current: $MAJOR.$MINOR.$PATCH"
if [ "$LATEST_TAG" = "v0.0.0" ]; then
COMMITS=$(git log --pretty=format:"%s" HEAD)
else
COMMITS=$(git log --pretty=format:"%s" "${LATEST_TAG}..HEAD")
fi
BUMP="patch"
if echo "$COMMITS" | grep -qiE "^feat(\(.+\))?!:|BREAKING CHANGE:"; then
BUMP="major"
elif echo "$COMMITS" | grep -qiE "^feat(\(.+\))?:"; then
BUMP="minor"
fi
echo "Bump type: $BUMP"
case $BUMP in
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
patch) PATCH=$((PATCH + 1)) ;;
esac
echo "New version: $MAJOR.$MINOR.$PATCH"
echo "$MAJOR.$MINOR.$PATCH" > .version
echo "v$MAJOR.$MINOR.$PATCH" > .tag
cat .version
cat .tag
depends_on: [build-and-test]
# Package NuGet
- name: package
image: mcr.microsoft.com/dotnet/sdk:10.0
commands:
- |
VERSION=$(cat .version)
echo "Packaging version $VERSION"
dotnet restore
dotnet build -c Release
dotnet pack PaperlessMCP/PaperlessMCP.csproj -c Release -o ./artifacts /p:Version=$VERSION /p:PackageVersion=$VERSION
ls -la ./artifacts/
depends_on: [version]
# Build and push Docker with Kaniko
- name: docker
image: gcr.io/kaniko-project/executor:debug
environment:
GHCR_USERNAME:
from_secret: github_username
GHCR_TOKEN:
from_secret: github_token
commands:
- |
VERSION=$(cat .version)
echo "Building Docker image version: $VERSION"
mkdir -p /kaniko/.docker
echo "{\"auths\":{\"ghcr.io\":{\"username\":\"$GHCR_USERNAME\",\"password\":\"$GHCR_TOKEN\"}}}" > /kaniko/.docker/config.json
/kaniko/executor --context="$CI_WORKSPACE/PaperlessMCP" --dockerfile="$CI_WORKSPACE/PaperlessMCP/Dockerfile" --destination="ghcr.io/barryw/paperlessmcp:v$VERSION" --destination="ghcr.io/barryw/paperlessmcp:latest" --build-arg="VERSION=$VERSION"
depends_on: [version]
# Create git tag and push
- name: git-tag
image: alpine/git
environment:
GITHUB_TOKEN:
from_secret: github_token
commands:
- echo "Token length $${#GITHUB_TOKEN}"
- TAG=$$(cat .tag) && VERSION=$$(cat .version) && echo "Creating tag $$TAG for version $$VERSION" && git config user.email "ci@woodpecker.local" && git config user.name "Woodpecker CI" && git remote set-url origin "https://x-access-token:$${GITHUB_TOKEN}@github.com/barryw/PaperlessMCP.git" && git tag -a "$$TAG" -m "Release $$VERSION" && git push origin "$$TAG"
depends_on: [package, docker]
# Create GitHub release
- name: release
image: alpine
environment:
GITHUB_TOKEN:
from_secret: github_token
commands:
- apk add --no-cache curl
- |
TAG=$$(cat .tag)
VERSION=$$(cat .version)
echo "Creating GitHub release for $$TAG"
curl -X POST \
-H "Authorization: token $$GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/barryw/PaperlessMCP/releases \
-d "{\"tag_name\":\"$$TAG\",\"name\":\"Release $$VERSION\",\"body\":\"Release $$VERSION\",\"draft\":false,\"prerelease\":false}"
depends_on: [git-tag]
# Deploy to Kubernetes (uses in-cluster service account)
- name: deploy
image: bitnami/kubectl:latest
commands:
- |
VERSION=$$(cat .version)
echo "Deploying version $$VERSION to Kubernetes"
# Update deployment image to specific version tag
kubectl set image deployment/paperless-mcp \
paperless-mcp=ghcr.io/barryw/paperlessmcp:v$$VERSION \
-n default
# Wait for rollout to complete
kubectl rollout status deployment/paperless-mcp -n default --timeout=120s
echo "Deployment complete!"
depends_on: [docker, release]