From a0956c37cfdb12e8e8462a390a341ffffc8640a8 Mon Sep 17 00:00:00 2001 From: Derek Slenk Date: Wed, 16 Jul 2025 00:04:42 -0400 Subject: [PATCH] Add Forgejo Actions workflows for CI/CD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create CI workflow for automated testing on push/PR - Create deployment workflow with secrets handling - Use self-hosted runners with existing Node.js installation - Support YouTube API key and AWS credentials from repository secrets 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .forgejo/workflows/ci.yml | 37 ++++++++++++++++++++++++++ .forgejo/workflows/deploy.yml | 49 +++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .forgejo/workflows/ci.yml create mode 100644 .forgejo/workflows/deploy.yml diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..5067911 --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [ main, master, feature/* ] + pull_request: + branches: [ main, master ] + +jobs: + test: + runs-on: self-hosted + steps: + - name: Checkout code + uses: https://codeberg.org/actions/checkout@v4 + + - name: Cache node modules + uses: https://codeberg.org/actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + run: npm ci + + - name: Run linting + run: npm run lint + + - name: Run type checking + run: npm run typecheck + + - name: Build application + run: npm run build + env: + # Use empty string for YOUTUBE_API_KEY during CI build + YOUTUBE_API_KEY: "" \ No newline at end of file diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..f10b7ac --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,49 @@ +name: Deploy + +on: + push: + branches: [ main, master ] + workflow_dispatch: + +jobs: + deploy: + runs-on: self-hosted + steps: + - name: Checkout code + uses: https://codeberg.org/actions/checkout@v4 + + - name: Cache node modules + uses: https://codeberg.org/actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + run: npm ci + + - name: Build application + run: npm run build + env: + # Access YouTube API key from repository secrets + YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} + + - name: Deploy to S3 (if configured) + run: | + if [ -n "${{ secrets.AWS_ACCESS_KEY_ID }}" ]; then + echo "Deploying to S3..." + npm run deploy:s3 + else + echo "AWS credentials not configured, skipping S3 deployment" + fi + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} + + - name: Upload build artifacts + uses: https://codeberg.org/actions/upload-artifact@v3 + with: + name: build-output + path: out/ \ No newline at end of file