|
| 1 | +name: Deploy demo |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +jobs: |
| 9 | + deploy: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + - name: Set up Python |
| 14 | + uses: actions/setup-python@v2 |
| 15 | + with: |
| 16 | + python-version: 3.8 |
| 17 | + - uses: actions/cache@v2 |
| 18 | + name: Configure pip caching |
| 19 | + with: |
| 20 | + path: ~/.cache/pip |
| 21 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} |
| 22 | + restore-keys: | |
| 23 | + ${{ runner.os }}-pip- |
| 24 | + - name: Download database |
| 25 | + run: | |
| 26 | + curl -O https://github-to-sqlite.dogsheep.net/github.db |
| 27 | + - name: Install Python dependencies |
| 28 | + run: | |
| 29 | + pip install -e .[test] |
| 30 | + - name: Generate fixtures.db |
| 31 | + run: | |
| 32 | + python tests/fixtures.py fixtures.db |
| 33 | + - name: Create Metadata |
| 34 | + run: | |
| 35 | + echo '{ |
| 36 | + "title": "datasette-graphql demo", |
| 37 | + "about": "simonw/datasette-graphql", |
| 38 | + "about_url": "https://github.com/simonw/datasette-graphql", |
| 39 | + "description_html": "Try it out at <a href=\"/graphql\">/graphql</a>" |
| 40 | + }' > metadata.json |
| 41 | + - name: Set up Cloud Run |
| 42 | + uses: GoogleCloudPlatform/github-actions/setup-gcloud@master |
| 43 | + with: |
| 44 | + version: '275.0.0' |
| 45 | + service_account_email: ${{ secrets.GCP_SA_EMAIL }} |
| 46 | + service_account_key: ${{ secrets.GCP_SA_KEY }} |
| 47 | + - name: Deploy to Cloud Run |
| 48 | + run: |- |
| 49 | + gcloud config set run/region us-central1 |
| 50 | + gcloud config set project datasette-222320 |
| 51 | + datasette publish cloudrun github.db fixtures.db \ |
| 52 | + -m metadata.json \ |
| 53 | + --install=https://github.com/simonw/datasette-graphql/archive/$GITHUB_SHA.zip \ |
| 54 | + --service datasette-graphql-demo |
0 commit comments