Fly Deploy #1114
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: Fly Deploy | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "27 */8 * * *" | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- ".github/**" | |
- "*.duckdb" | |
jobs: | |
deploy: | |
name: Deploy app | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.head_commit.message, 'Latest data') }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: pip | |
- name: Install python dependencies | |
run: pip install -r requirements.txt | |
- name: Build database | |
run: | | |
sh build-db.sh | |
- run: > | |
datasette publish fly | |
spotify.db --app="esporifai" -m metadata.yml | |
--install datasette-auth-github | |
--install datasette-auth-tokens | |
--install datasette-vega | |
--install datasette-dashboards | |
--install datasette-copyable | |
--install datasette-plot | |
--setting force_https_urls 1 | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: Commit and push if it changed | |
run: |- | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Latest data: ${timestamp}" || exit 0 | |
echo '### Changed files' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
git show --name-only --format=tformat: >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
git pull --rebase | |
git push |