Merge pull request #28 from ubiquity-os-marketplace/development #3
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: Database | |
on: | |
push: | |
branches: | |
- main | |
env: | |
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | |
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} | |
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }} | |
jobs: | |
run-migration: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.10.0" | |
- uses: supabase/setup-cli@v1 | |
with: | |
version: latest | |
- name: Link Supabase project | |
run: supabase link --project-ref $SUPABASE_PROJECT_ID | |
- name: Run migrations | |
run: supabase db push | |
generate_types: | |
runs-on: ubuntu-latest | |
needs: | |
- run-migration | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.10.0" | |
- name: Generate Supabase Types | |
run: | | |
yarn install | |
yarn run "supabase:generate:remote" | |
- name: Commit and Push generated types | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add src/types/database.ts | |
if [ -n "$(git diff-index --cached --name-only HEAD)" ]; then | |
git commit -m "chore: updated generated Supabase types" || echo "Lint-staged check failed" | |
git push origin main | |
else | |
echo "No changes to commit" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |