feat: dsp #63
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Preview | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
jobs: | |
preview: | |
name: PR | |
runs-on: ubuntu-latest | |
environment: Preview | |
permissions: | |
id-token: write # Needed for auth with Deno Deploy | |
contents: read # Needed to clone the repository | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Get branch name | |
id: branch_name | |
uses: tj-actions/branch-names@v8 | |
- name: Create Neon Branch | |
id: create_neon_branch | |
uses: neondatabase/create-branch-action@v4 | |
with: | |
project_id: ${{ vars.NEON_PROJECT_ID }} | |
branch_name: preview/pr-${{ github.event.number }}-${{ steps.branch_name.outputs.current_branch }} | |
api_key: ${{ secrets.NEON_API_KEY }} | |
- name: Set DATABASE_URL | |
shell: bash | |
run: | | |
echo "DATABASE_URL=${{ steps.create_neon_branch.outputs.db_url }}?sslmode=require" >> $GITHUB_ENV | |
- name: Install Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- name: Install Bun | |
uses: oven-sh/setup-bun@v1 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- name: Uninstall dev deps with scripts | |
run: npm remove @vite-pwa/assets-generator --ignore-scripts=true | |
- name: Install dependencies | |
run: npm i --ignore-scripts=true | |
- name: Install dev deps with scripts | |
run: npm i @vite-pwa/assets-generator -D | |
- name: Build | |
run: bun run build | |
- name: Generate .env file | |
uses: SpicyPizza/create-envfile@v2.0 | |
with: | |
envkey_DATABASE_URL: ${{ env.DATABASE_URL }} | |
envkey_OAUTH_GITHUB_CLIENT_ID: ${{ secrets.OAUTH_GITHUB_CLIENT_ID }} | |
envkey_OAUTH_GITHUB_CLIENT_SECRET: ${{ secrets.OAUTH_GITHUB_CLIENT_SECRET }} | |
- name: Run migrations | |
run: bun run kysely -- migrate:latest | |
- name: Run tests | |
run: bun run test | |
- name: Upload coverage deno | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage/lcov-deno.info | |
- name: Upload coverage web | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage/lcov.info | |
- name: Copy .env to .env.production | |
run: cp .env .env.production | |
- name: Upload to Deno Deploy | |
uses: denoland/deployctl@v1 | |
with: | |
project: vasi | |
root: "" | |
include: .env.production,api,dist | |
entrypoint: ./api/core/server.ts | |
import-map: ./api/import-map.production.json |