Demo Reset #133
This file contains hidden or 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: Demo Reset | |
| on: | |
| schedule: | |
| - cron: "0 4 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| reset: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Stop running machines | |
| run: | | |
| for id in $(flyctl machine list -a craftplan --json | jq -r '.[].id'); do | |
| flyctl machine stop "$id" -a craftplan || true | |
| done | |
| sleep 10 | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| - name: Reset demo database | |
| run: | | |
| MACHINE_ID=$(flyctl machine list -a craftplan --json | jq -r '.[0].id') | |
| flyctl machine start "$MACHINE_ID" -a craftplan | |
| sleep 15 | |
| flyctl ssh console -a craftplan -C "sh -c 'unset PHX_SERVER && SEED_DATA=true bin/craftplan eval Craftplan.Release.reset'" | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| - name: Redeploy to clean restart | |
| run: flyctl deploy --image ghcr.io/puemos/craftplan:latest -a craftplan | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |