Create neon-preview-branches-for-pull-requests-nameless-salad-9622464… #176
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: migrate | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v4 | |
id: cache-files | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-cache-${{ hashFiles('**/yarn.lock') }} | |
- name: Install Dependencies | |
if: ${{ steps.cache-files.outputs.cache-hit != 'true' }} | |
run: yarn | |
migrate-for-production: | |
environment: production | |
if: github.ref_name == 'main' | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- name: Restore cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-cache-${{ hashFiles('**/yarn.lock') }} | |
- name: Create .env | |
shell: bash | |
run: | | |
echo DATABASE_URL="${{ secrets.DATABASE_URL_FOR_MIGRATION }}" > packages/api/.env | |
- name: Generate Scema | |
run: yarn turbo run schema:gen --filter=@repo/api | |
- name: lint:fix | |
run: | | |
yarn format-and-lint:fix | |
- name: Migrate | |
uses: nick-fields/retry@v3 | |
with: | |
command: yarn turbo run migrate --filter=@repo/api | |
max_attempts: 5 | |
timeout_minutes: 10 | |
retry_on: error |