From c53e2aafc5be6fe5fab61d934576e2759f66744f Mon Sep 17 00:00:00 2001 From: Jack Jackson Date: Sat, 5 Apr 2025 14:43:11 -0700 Subject: [PATCH] Coerce types to match when dealing with ties Also add a rudimentary publication workflow, as I'm migrating away from Drone - see [here](https://blog.scubbo.org/posts/gitea-actions/). --- .gitea/workflows/publish.yaml | 50 +++++++++++++++++++++++++++++++++++ app/routers/games.py | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/publish.yaml diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml new file mode 100644 index 0000000..a082517 --- /dev/null +++ b/.gitea/workflows/publish.yaml @@ -0,0 +1,50 @@ +name: Publish +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Import Secrets + id: import-secrets + uses: hashicorp/vault-action@v2 + with: + url: http://vault.avril + method: kubernetes + # TODO - when https://github.com/go-gitea/gitea/pull/33945 is merged, instead use per-workflow OIDC-based auth + role: act-runner-helm-charts + secrets: | + shared-secrets/gitea/pat_to_push_images token | GITEA_TOKEN + + - name: Login to Gitea + uses: docker/login-action@v3 + with: + username: scubbo + password: ${{ env.GITEA_TOKEN }} + + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push image + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile + target: prod + push: true + platforms: linux/amd64,linux/arm64 + tags: | + scubbo/edh-elo:${{ gitea.sha }} + scubbo/edh-elo:latest + + - name: Output + run: | + echo "Image pushed: scubbo/edh-elo:${{ gitea.sha }}" + + # TODO - update Helm chart with new image \ No newline at end of file diff --git a/app/routers/games.py b/app/routers/games.py index 12f3560..5f1a74e 100644 --- a/app/routers/games.py +++ b/app/routers/games.py @@ -54,7 +54,7 @@ def create_game(game: schemas.GameCreate, db: Session = Depends(get_db)): if game.other_winning_deck_ids: winning_deck_ids.extend( [ - deck_ids.index(other_winning_id) + deck_ids.index(int(other_winning_id)) for other_winning_id in game.other_winning_deck_ids.split(",") ] )