Skip to content

Commit

Permalink
build(database): target the pr branch when applying migrations (#72)
Browse files Browse the repository at this point in the history
* build(database): target the pr branch when applying migrations

* fix: ci

* fix: ci

* fix: ci

* fix: ci
  • Loading branch information
tericcabrel authored Jun 22, 2024
1 parent 77b87dc commit e217e89
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 10 deletions.
38 changes: 35 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
DATABASE_URL: mysql://root:[email protected]:3306/test
CONVERTKIT_API_KEY: api_key
CONVERTKIT_FORM_ID: form_id
outputs:
releasedPackages: ${{ steps.releasedPackages.outputs.versions }}
steps:
- uses: actions/checkout@v4

Expand All @@ -46,11 +44,41 @@ jobs:
yarn prisma migrate dev --schema=packages/domain/prisma/schema.prisma
yarn test -- --runInBand --coverage
preview-frontend:
should-preview-frontend:
runs-on: ubuntu-latest
environment: 'Preview'
needs:
- build
outputs:
frontendChanged: ${{ steps.frontend-changed.outputs.any_changed }}
steps:
- uses: actions/checkout@v4

- name: Check if frontend files changed
id: frontend-changed
uses: tj-actions/changed-files@v44
with:
files_yaml: |
apps:
- apps/web/**
packages:
- packages/front/**
- name: Run step if test file(s) change
env:
ALL_CHANGED_FILES: ${{ steps.frontend-changed.outputs.all_changed_files }}
run: |
echo "Change state: ${{ steps.frontend-changed.outputs.any_changed }}"
echo "One or more test file(s) has changed."
echo "List all the files that have changed: $ALL_CHANGED_FILES"
preview-frontend:
runs-on: ubuntu-latest
environment: 'Preview'
needs:
- should-preview-frontend
if: ${{ needs.should-preview-frontend.frontendChanged == 'true' }}
steps:
- uses: actions/checkout@v4

Expand All @@ -60,15 +88,19 @@ jobs:
yarn set version 4.2.2
- name: Install Vercel CLI
if: ${{ success() }}
run: npm install --global vercel@latest

- name: Pull Vercel Environment Information
if: ${{ success() }}
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
if: ${{ success() }}
env:
APP_VERSION:
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
if: ${{ success() }}
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/migration-db-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: planetscale/setup-pscale-action@v1

- name: Set database branch name
run: echo "PSCALE_BRANCH_NAME=$(echo ${{ github.head_ref }} | tr -cd '[:alnum:]-'| tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
run: echo "PSCALE_BRANCH_NAME=$(echo ${{ github.ref_name }} | tr -cd '[:alnum:]-'| tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Get the deploy request number in development branch
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/*
Warnings:
- You are about to drop the column `is_favorite` on the `folders` table. All the data in the column will be lost.
*/
-- DropIndex
DROP INDEX `folders_is_favorite_idx` ON `folders`;
Expand Down
10 changes: 6 additions & 4 deletions packages/front/.eslintrc.json → packages/front/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
module.exports = {
"root": true,
"extends": "../../.eslintrc.json",
"ignorePatterns": [
"postcss.config.js",
"tailwind.config.js",
"jest.config.ts",
"generated.ts"
"generated.ts",
'.eslintrc.js'
],
"parserOptions": {
"ecmaVersion": 2023,
"sourceType": "module",
"project": "tsconfig.json"
"project": "tsconfig.json",
tsconfigRootDir: __dirname,
}
}
};

0 comments on commit e217e89

Please sign in to comment.