Actualizar .gitea/workflows/update.yaml
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
name: Update database types
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- supabase/migrations/*.sql
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_DESARROLLO_ACCESS_TOKEN }}
|
||||
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_DESARROLLO_PROJECT_ID }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: supabase/setup-cli@v1
|
||||
with:
|
||||
version: latest
|
||||
- name: Link supabase project
|
||||
run: supabase link --project-ref $SUPABASE_PROJECT_ID
|
||||
- name: Generar seed de supabase
|
||||
run: supabase db dump -f supabase/seed.sql --data-only
|
||||
- name: Generar tipos de supabase
|
||||
run: supabase gen types typescript --local > supabase/functions/_shared/database.types.ts
|
||||
|
||||
- name: Check for changes
|
||||
id: git_status
|
||||
run: |
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
echo "changed=true" >> $GITEA_OUTPUT
|
||||
else
|
||||
echo "changed=false" >> $GITEA_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Commit changes
|
||||
if: steps.git_status.outputs.changed == 'true'
|
||||
run: |
|
||||
git config user.name "supabot"
|
||||
git config user.email "supabot@example.com"
|
||||
git add supabase/seed.sql
|
||||
git add supabase/functions/_shared/database.types.ts
|
||||
git commit -m "chore: update database seed & types"
|
||||
|
||||
- name: Push changes
|
||||
if: steps.git_status.outputs.changed == 'true'
|
||||
run: |
|
||||
git pull
|
||||
git push
|
||||
Reference in New Issue
Block a user