Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bug report
about: Create a report to help us improve
title: Bug report
labels: bug
assignees: ''
assignees: ""
---

**Describe the bug** A clear and concise description of what the bug is.
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Feature request
about: Suggest an idea or voice a concern
title: 'Feature request: '
title: "Feature request: "
labels: enhancement
assignees: ''
assignees: ""
---

**Is your feature request related to a problem? Please describe.** A clear and
Expand Down
124 changes: 110 additions & 14 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,130 @@
name: Deploy
name: Deploy to Production
on:
push:
branches: [main]
pull_request:
branches: main

env:
DENO_DEPLOY_PROJECT: trendradar-api

jobs:
deploy:
name: Deploy
test:
name: Run Tests
runs-on: ubuntu-latest
env:
GITHUB_CLIENT_ID: ${{ secrets.GITHUB_CLIENT_ID }}
GITHUB_CLIENT_SECRET: ${{ secrets.GITHUB_CLIENT_SECRET }}
steps:
- name: Clone repository
uses: actions/checkout@v5

- name: Install Deno
uses: denoland/setup-deno@v2

- name: Cache dependencies
run: deno cache --lock=deno.lock main.ts

- name: Run linter
run: deno lint

permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository
- name: Run type check
run: deno check main.ts

- name: Run tests
run: deno test --allow-all

security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v5

- name: Install Deno
uses: denoland/setup-deno@v2

- name: Build step
run: deno task build # 📝 Update the build command(s) if necessary
- name: Run security audit
run: deno info --json | jq '.modules[] | select(.permissions.run == true or .permissions.read == true)'

- name: Check for vulnerabilities
run: |
# Check for common security issues
if grep -r "eval(" --include="*.ts" --include="*.js" .; then
echo "Warning: eval() usage found"
fi

build:
name: Build Application
runs-on: ubuntu-latest
needs: [test, security]
steps:
- name: Clone repository
uses: actions/checkout@v5

- name: Install Deno
uses: denoland/setup-deno@v2

- name: Build application
run: deno task build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
./
!.git/
!node_modules/

- name: Upload to Deno Deploy
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Clone repository
uses: actions/checkout@v5

- name: Install Deno
uses: denoland/setup-deno@v2

- name: Deploy to staging
uses: denoland/deployctl@v1
env:
DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}
with:
project: trendradar-staging
entrypoint: ./main.ts

deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: deploy-staging
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
environment: production
steps:
- name: Clone repository
uses: actions/checkout@v5

- name: Install Deno
uses: denoland/setup-deno@v2

- name: Health check staging
run: |
sleep 30
curl -f https://trendradar-staging.deno.dev/api/health || exit 1

- name: Deploy to production
uses: denoland/deployctl@v1
env:
DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}
with:
project: saaskit # 📝 Update the deploy project name if necessary
entrypoint: ./main.ts # 📝 Update the entrypoint if necessary
project: ${{ env.DENO_DEPLOY_PROJECT }}
entrypoint: ./main.ts

- name: Health check production
run: |
sleep 30
curl -f https://trendradar-api.deno.dev/api/health || exit 1

- name: Notify deployment success
run: |
echo "Deployment successful to production"
Loading
Loading