Skip to content

Merge branch 'main' of https://github.com/jpeckham/RaidLoop #57

Merge branch 'main' of https://github.com/jpeckham/RaidLoop

Merge branch 'main' of https://github.com/jpeckham/RaidLoop #57

name: Continuous Delivery
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
jobs:
detect-supabase-changes:
runs-on: ubuntu-latest
outputs:
supabase_changed: ${{ steps.paths.outputs.supabase || steps.default.outputs.supabase }}
steps:
- name: Checkout
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
uses: actions/checkout@v4
- name: Detect Supabase changes
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
id: paths
uses: dorny/paths-filter@v3
with:
filters: |
supabase:
- 'supabase/**'
- name: Default Supabase change flag
if: ${{ github.event_name != 'push' && github.event_name != 'pull_request' }}
id: default
run: echo "supabase=false" >> "$GITHUB_OUTPUT"
deploy-supabase:
needs: detect-supabase-changes
if: ${{ github.event_name == 'push' && needs.detect-supabase-changes.outputs.supabase_changed == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_PROJECT_ID: ${{ vars.SUPABASE_PROJECT_ID }}
SUPABASE_URL: ${{ vars.SUPABASE_URL }}
SUPABASE_PUBLISHABLE_KEY: ${{ vars.SUPABASE_PUBLISHABLE_KEY }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect Supabase changes
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
migrations:
- 'supabase/migrations/**'
functions:
- 'supabase/functions/**'
- 'supabase/config.toml'
- name: Setup Node.js
if: ${{ steps.changes.outputs.migrations == 'true' || steps.changes.outputs.functions == 'true' }}
uses: actions/setup-node@v4
with:
node-version: 24
- name: Setup Supabase CLI
if: ${{ steps.changes.outputs.migrations == 'true' || steps.changes.outputs.functions == 'true' }}
uses: supabase/setup-cli@v1
with:
version: 2.81.3
- name: Validate migration secrets
if: ${{ steps.changes.outputs.migrations == 'true' }}
run: |
test -n "$SUPABASE_PROJECT_ID"
test -n "$SUPABASE_URL"
test -n "$SUPABASE_PUBLISHABLE_KEY"
test -n "$SUPABASE_DB_PASSWORD"
- name: Link Supabase project
if: ${{ steps.changes.outputs.migrations == 'true' }}
run: supabase link --project-ref "$SUPABASE_PROJECT_ID" --password "$SUPABASE_DB_PASSWORD" --yes
- name: Apply database migrations
if: ${{ steps.changes.outputs.migrations == 'true' }}
run: supabase db push --linked --include-all --password "$SUPABASE_DB_PASSWORD"
- name: Validate function deploy secrets
if: ${{ steps.changes.outputs.functions == 'true' }}
run: |
test -n "$SUPABASE_ACCESS_TOKEN"
test -n "$SUPABASE_PROJECT_ID"
test -n "$SUPABASE_URL"
test -n "$SUPABASE_PUBLISHABLE_KEY"
- name: Deploy Edge Functions
if: ${{ steps.changes.outputs.functions == 'true' }}
run: |
supabase functions deploy profile-bootstrap --project-ref "$SUPABASE_PROJECT_ID"
supabase functions deploy profile-save --project-ref "$SUPABASE_PROJECT_ID"
supabase functions deploy game-action --project-ref "$SUPABASE_PROJECT_ID"
continuous-delivery:
needs: [detect-supabase-changes, deploy-supabase]
if: >-
always() &&
(
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
(github.event_name == 'push' &&
(needs.detect-supabase-changes.outputs.supabase_changed != 'true' ||
needs.deploy-supabase.result == 'success' ||
needs.deploy-supabase.result == 'skipped'))
)
uses: jpeckham/.github/.github/workflows/continuous-delivery-dotnet-blazor-github-pages.yml@main
with:
main_branch: main
dotnet_version: 10.0.x
solution_path: RaidLoop.sln
test_project_path: tests/RaidLoop.Core.Tests/RaidLoop.Core.Tests.csproj
publish_project_path: src/RaidLoop.Client/RaidLoop.Client.csproj
publish_output_dir: publish
version_file: version.json
coverage_badge_path: .github/badges/coverage.svg
coverage_pages_subpath: coverage
repository_private: ${{ github.event.repository.private }}
secrets: inherit