### Local SproutOS Deployment Commands Source: https://sproutos.me/docs/github-action Commands to authenticate, select an organization, and deploy a project using the SproutOS CLI. ```bash sprout auth login sprout org use my-team sprout deploy my-web-project --preset next \ --path apps/website/.next/standalone ``` -------------------------------- ### Configure GitHub Actions for migration and deployment Source: https://sproutos.me/docs/database-migrations Use a dedicated migrator job with the sproutos-deploy-action and set the needs property on subsequent deployment jobs to ensure sequential execution. ```yaml name: Migrate and deploy to SproutOS on: push: branches: [main] permissions: contents: read id-token: write jobs: migrate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci - run: npm run build:migrator - uses: MySproutOS/sproutos-deploy-action@0d5ce8bb74ecd598ae996c34d7d2cb5ac156a180 with: preset: hono directory: apps/migrator/dist project: my-app-migrator migration-directory: apps/migrator/dist migration-handler: migrate.handler api-url: https://api.sproutos.me deploy-web: needs: migrate runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci - run: npm run build - uses: MySproutOS/sproutos-deploy-action@0d5ce8bb74ecd598ae996c34d7d2cb5ac156a180 with: preset: next directory: apps/website/.next/standalone project: my-app-web api-url: https://api.sproutos.me ``` -------------------------------- ### Connect to Object Storage with Python boto3 Source: https://sproutos.me/docs/object-storage Use the boto3 library to interact with SproutOS storage. Ensure path-style addressing is enabled and do not provide an AWS session token. ```python import os import boto3 from botocore.config import Config s3 = boto3.client( "s3", endpoint_url=os.environ["S3_ENDPOINT"], region_name=os.environ["S3_REGION"], aws_access_key_id=os.environ["S3_ACCESS_KEY_ID"], aws_secret_access_key=os.environ["S3_SECRET_ACCESS_KEY"], config=Config(s3={"addressing_style": "path"}), ) bucket = os.environ["S3_BUCKET_NAME"] s3.put_object(Bucket=bucket, Key="photos/cat.jpg", Body=image_bytes) photo = s3.get_object(Bucket=bucket, Key="photos/cat.jpg")["Body"].read() ``` -------------------------------- ### GitHub Actions Workflow for SproutOS Deployment Source: https://sproutos.me/docs/github-action A standard workflow configuration that builds a project and deploys it to SproutOS using the official action. Requires id-token: write permissions for secure OIDC authentication. ```yaml name: Deploy to SproutOS on: push: branches: [main] permissions: contents: read id-token: write jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci - run: npm run build - uses: MySproutOS/sproutos-deploy-action@0d5ce8bb74ecd598ae996c34d7d2cb5ac156a180 with: preset: next directory: apps/website/.next/standalone project: my-web-project api-url: https://api.sproutos.me ``` -------------------------------- ### Run migrations in GitHub Actions Source: https://sproutos.me/docs/database-migrations Executes database migrations directly on a GitHub runner using a production database URL stored as a secret. ```yaml jobs: migrate: runs-on: ubuntu-latest env: DATABASE_URL: ${{ secrets.PRODUCTION_DATABASE_URL }} steps: - uses: actions/checkout@v5 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci - run: npm run migrate deploy-web: needs: migrate # Build and deploy the application here. ``` -------------------------------- ### Connect to Object Storage with TypeScript AWS SDK Source: https://sproutos.me/docs/object-storage Use the AWS SDK for JavaScript to interact with SproutOS storage. Set forcePathStyle to true in the client configuration. ```typescript import { GetObjectCommand, PutObjectCommand, S3Client } from "@aws-sdk/client-s3" const s3 = new S3Client({ endpoint: process.env.S3_ENDPOINT, region: process.env.S3_REGION, credentials: { accessKeyId: process.env.S3_ACCESS_KEY_ID!, secretAccessKey: process.env.S3_SECRET_ACCESS_KEY!, }, forcePathStyle: true, }) const Bucket = process.env.S3_BUCKET_NAME! await s3.send(new PutObjectCommand({ Bucket, Key: "exports/report.json", Body: report })) const stored = await s3.send(new GetObjectCommand({ Bucket, Key: "exports/report.json" })) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.