# BlumeOps Release Workflow # # Creates a versioned release of BlumeOps with all build artifacts. # Currently includes: # - Documentation site (Quartz static build) # - Changelog (built from towncrier fragments) # # Usage: # 1. Go to Actions > Build BlumeOps > Run workflow # 2. Enter a version tag (e.g., v1.2.0) or leave empty to auto-increment patch # 3. The workflow creates a release with attached artifacts # # Documentation asset URL: # https://forge.ops.eblu.me/eblume/blumeops/releases/download//docs-.tar.gz name: Build BlumeOps on: workflow_dispatch: inputs: version: description: 'Version (e.g., v1.2.0) or empty to auto-increment patch (v_._.+1)' required: false default: '' type: string jobs: build: runs-on: k8s steps: - name: Resolve version id: version run: | INPUT_VERSION="${{ inputs.version }}" if [ -n "$INPUT_VERSION" ]; then # User provided a version - validate it if [[ ! "$INPUT_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "Error: Version must be in format vX.Y.Z (e.g., v1.0.0)" exit 1 fi VERSION="$INPUT_VERSION" echo "Using provided version: $VERSION" else # Auto-increment patch version from latest release echo "Fetching latest release..." LATEST=$(curl -s "https://forge.ops.eblu.me/api/v1/repos/eblume/blumeops/releases/latest" | jq -r '.tag_name // empty' || true) if [ -z "$LATEST" ]; then VERSION="v1.0.0" echo "No previous releases found, starting at: $VERSION" else # Parse vX.Y.Z and increment patch VERSION=$(echo "$LATEST" | awk -F. '{print $1"."$2"."$3+1}') echo "Auto-incremented from $LATEST to: $VERSION" fi fi # Check if this version already exists if curl -sf "https://forge.ops.eblu.me/api/v1/repos/eblume/blumeops/releases/tags/$VERSION" > /dev/null 2>&1; then echo "Error: Release $VERSION already exists" echo "See: https://forge.ops.eblu.me/eblume/blumeops/releases/tag/$VERSION" exit 1 fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "Building BlumeOps release: $VERSION" - name: Checkout uses: actions/checkout@v4 with: # Need full history for git operations fetch-depth: 0 - name: Install uv run: | curl -LsSf https://astral.sh/uv/install.sh | sh echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Build changelog run: | VERSION="${{ steps.version.outputs.version }}" # Check if there are any changelog fragments FRAGMENTS=$(find docs/changelog.d -name "*.md" -not -name ".gitkeep" 2>/dev/null | wc -l) if [ "$FRAGMENTS" -gt 0 ]; then echo "Found $FRAGMENTS changelog fragments, building changelog..." ~/.local/bin/uvx towncrier build --version "$VERSION" --yes echo "changelog_updated=true" >> "$GITHUB_OUTPUT" else echo "No changelog fragments found, skipping towncrier" echo "changelog_updated=false" >> "$GITHUB_OUTPUT" fi id: changelog - name: Commit changelog updates if: steps.changelog.outputs.changelog_updated == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | VERSION="${{ steps.version.outputs.version }}" # Configure git git config user.name "Forgejo Actions" git config user.email "actions@forge.ops.eblu.me" # Stage changes (CHANGELOG.md updated, fragments removed) git add docs/CHANGELOG.md docs/changelog.d/ # Commit git commit -m "Release $VERSION: Update changelog Built changelog from towncrier fragments. [skip ci]" # Push to main git push origin HEAD:main echo "Changelog committed and pushed" - name: Build docs run: | VERSION="${{ steps.version.outputs.version }}" echo "Node version: $(node --version)" echo "NPM version: $(npm --version)" # Clone Quartz git clone --depth 1 https://github.com/jackyzha0/quartz.git /tmp/quartz cd /tmp/quartz # Install dependencies npm ci # Copy our configuration (lives in docs/ to keep repo root clean) cp "$GITHUB_WORKSPACE/docs/quartz.config.ts" . cp "$GITHUB_WORKSPACE/docs/quartz.layout.ts" . # Copy docs as content (includes index.md) rm -rf content cp -r "$GITHUB_WORKSPACE/docs" content # Build echo "Building static site..." npx quartz build # Create tarball TARBALL="docs-${VERSION}.tar.gz" echo "Creating tarball: $TARBALL" tar -czf "$GITHUB_WORKSPACE/$TARBALL" -C public . echo "Build complete!" ls -lh "$GITHUB_WORKSPACE/$TARBALL" - name: Create release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | VERSION="${{ steps.version.outputs.version }}" TARBALL="docs-${VERSION}.tar.gz" echo "Creating release $VERSION..." # Use Forgejo API to create release (requires authentication) RELEASE_DATA=$(cat <