name: Generate sqlx-data.json
on:
push:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Setup cache
uses: Swatinem/rust-cache@v2
- name: Install sqlx-cli
if: steps.rust-cache.outputs.cache-hit != 'true'
run: cargo install sqlx-cli --no-default-features --features rustls,postgres
- run: cargo sqlx mig run && cargo sqlx prepare -- --all-features
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres"
- name: Commit sqlx-data.json
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Update sqlx-data.json" || true
git push || true