fix(manifest): stop chr(0) advisory lock flooding Postgres 54000 (#2769) #11235
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: Bump version | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - development | |
| permissions: {} | |
| jobs: | |
| changes: | |
| if: ${{ !startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'chore(auto-sync):') }} | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run_capgo: ${{ steps.capgo.outputs.should_release }} | |
| capgo_release_as: ${{ steps.capgo.outputs.release_as }} | |
| run_cli: ${{ steps.cli.outputs.should_release }} | |
| cli_release_as: ${{ steps.cli.outputs.release_as }} | |
| run_notifications: ${{ steps.notifications.outputs.should_release }} | |
| notifications_release_as: ${{ steps.notifications.outputs.release_as }} | |
| has_migration_changes: ${{ steps.migration_scope.outputs.has_migration_changes }} | |
| run_any: ${{ steps.capgo.outputs.should_release == 'true' || steps.cli.outputs.should_release == 'true' || steps.notifications.outputs.should_release == 'true' }} | |
| steps: | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24.x | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| filter: blob:none | |
| - name: Setup bun | |
| run: bash scripts/setup-bun.sh | |
| - name: Resolve Capgo release scope | |
| id: capgo | |
| run: bun scripts/release-scope.ts capgo "${{ github.event.before }}" "${{ github.sha }}" >> "$GITHUB_OUTPUT" | |
| - name: Resolve CLI release scope | |
| id: cli | |
| run: bun scripts/release-scope.ts cli "${{ github.event.before }}" "${{ github.sha }}" >> "$GITHUB_OUTPUT" | |
| - name: Resolve notifications plugin release scope | |
| id: notifications | |
| run: bun scripts/release-scope.ts notifications "${{ github.event.before }}" "${{ github.sha }}" >> "$GITHUB_OUTPUT" | |
| - name: Resolve migration scope | |
| id: migration_scope | |
| run: | | |
| if git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" | grep -q '^supabase/migrations/'; then | |
| echo "has_migration_changes=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "has_migration_changes=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| # Run only the relevant test scope before creating tags | |
| test: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.run_any == 'true' }} | |
| uses: ./.github/workflows/tests.yml | |
| with: | |
| run_capgo: ${{ needs.changes.outputs.run_capgo == 'true' }} | |
| run_cli: ${{ needs.changes.outputs.run_cli == 'true' }} | |
| run_notifications: ${{ needs.changes.outputs.run_notifications == 'true' }} | |
| permissions: | |
| contents: read | |
| actions: write | |
| # The reusable tests workflow declares PR read access for its path filter job. | |
| pull-requests: read | |
| # Only bump the changed release scopes and create matching tags after tests pass | |
| bump-version: | |
| needs: [changes, test] | |
| if: ${{ !startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'chore(auto-sync):') && needs.changes.outputs.run_any == 'true' && needs.test.result == 'success' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| name: Bump versions and create tags | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24.x | |
| - name: Check out | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| filter: blob:none | |
| token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| if: ${{ needs.changes.outputs.run_capgo == 'true' || needs.changes.outputs.run_cli == 'true' || needs.changes.outputs.run_notifications == 'true' }} | |
| run: bun install --frozen-lockfile | |
| - name: Git config | |
| run: | | |
| git config --local user.name "github-actions[bot]" | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Install Graphify | |
| run: python3 -m pip install --user graphifyy==0.8.31 | |
| - name: Generate CLI docs | |
| if: ${{ needs.changes.outputs.run_cli == 'true' }} | |
| run: | | |
| bun run cli:build | |
| bun run --cwd cli generate-docs | |
| bun run --cwd cli generate-docs --folder webdocs | |
| git add cli/README.md cli/webdocs | |
| if ! git diff --cached --quiet; then | |
| git commit -m "docs(cli): update generated docs" | |
| fi | |
| - name: Create version bumps | |
| env: | |
| RUN_CAPGO: ${{ needs.changes.outputs.run_capgo }} | |
| CAPGO_RELEASE_AS: ${{ needs.changes.outputs.capgo_release_as }} | |
| RUN_CLI: ${{ needs.changes.outputs.run_cli }} | |
| CLI_RELEASE_AS: ${{ needs.changes.outputs.cli_release_as }} | |
| RUN_NOTIFICATIONS: ${{ needs.changes.outputs.run_notifications }} | |
| NOTIFICATIONS_RELEASE_AS: ${{ needs.changes.outputs.notifications_release_as }} | |
| run: | | |
| set -e | |
| refresh_graphify_graph() { | |
| bun run graphify:generate | |
| git add graphify-out | |
| if ! git diff --cached --quiet; then | |
| CURRENT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "") | |
| git commit --amend --no-edit | |
| if [ -n "$CURRENT_TAG" ]; then | |
| git tag -f "$CURRENT_TAG" | |
| fi | |
| fi | |
| } | |
| if [ "$RUN_CAPGO" = "true" ]; then | |
| if [ "${GITHUB_REF}" = "refs/heads/main" ]; then | |
| bunx standard-version --skip.changelog --release-as "$CAPGO_RELEASE_AS" --tag-prefix capgo- | |
| else | |
| bunx standard-version --skip.changelog --release-as "$CAPGO_RELEASE_AS" --prerelease alpha --tag-prefix capgo- | |
| fi | |
| git add supabase/functions/_backend/utils/version.ts | |
| if ! git diff --cached --quiet; then | |
| CURRENT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "") | |
| git commit --amend --no-edit | |
| if [ -n "$CURRENT_TAG" ]; then | |
| git tag -f "$CURRENT_TAG" | |
| fi | |
| fi | |
| refresh_graphify_graph | |
| fi | |
| if [ "$RUN_CLI" = "true" ]; then | |
| if [ "${GITHUB_REF}" = "refs/heads/main" ]; then | |
| bunx standard-version --skip.changelog --release-as "$CLI_RELEASE_AS" --tag-prefix cli- --packageFiles cli/package.json --bumpFiles cli/package.json | |
| else | |
| bunx standard-version --skip.changelog --release-as "$CLI_RELEASE_AS" --prerelease alpha --tag-prefix cli- --packageFiles cli/package.json --bumpFiles cli/package.json | |
| fi | |
| refresh_graphify_graph | |
| fi | |
| if [ "$RUN_NOTIFICATIONS" = "true" ]; then | |
| if [ "${GITHUB_REF}" = "refs/heads/main" ]; then | |
| bunx standard-version --skip.changelog --release-as "$NOTIFICATIONS_RELEASE_AS" --tag-prefix notifications- --packageFiles packages/capacitor-notifications/package.json --bumpFiles packages/capacitor-notifications/package.json | |
| else | |
| bunx standard-version --skip.changelog --release-as "$NOTIFICATIONS_RELEASE_AS" --prerelease alpha --tag-prefix notifications- --packageFiles packages/capacitor-notifications/package.json --bumpFiles packages/capacitor-notifications/package.json | |
| fi | |
| bun scripts/sync-notifications-package-version.ts | |
| git add packages/capacitor-notifications/src/version.ts | |
| if ! git diff --cached --quiet; then | |
| CURRENT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "") | |
| git commit --amend --no-edit | |
| if [ -n "$CURRENT_TAG" ]; then | |
| git tag -f "$CURRENT_TAG" | |
| fi | |
| fi | |
| fi | |
| - name: Push to origin | |
| run: | | |
| set -e | |
| CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
| remote_repo="https://${GITHUB_ACTOR}:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | |
| git pull --rebase=false $remote_repo $CURRENT_BRANCH | |
| git push $remote_repo HEAD:$CURRENT_BRANCH --follow-tags --tags | |
| sync_schema_types: | |
| needs: [changes, bump-version] | |
| if: ${{ github.ref == 'refs/heads/main' && needs.changes.outputs.has_migration_changes == 'true' && !startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'chore(auto-sync):') }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24.x | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | |
| fetch-depth: 0 | |
| filter: blob:none | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Sync generated schema and types | |
| env: | |
| SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_TOKEN }} | |
| run: | | |
| if [ -z "${{ secrets.SUPABASE_PROJECT_ID_PROD }}" ]; then | |
| echo "SUPABASE_PROJECT_ID_PROD is required for schema/types sync" >&2 | |
| exit 1 | |
| fi | |
| bunx supabase --version | |
| bunx supabase link --project-ref ${{ secrets.SUPABASE_PROJECT_ID_PROD }} | |
| bun schemas | |
| BRANCH=main bun types | |
| if git diff --quiet supabase/schemas/prod.sql src/types/supabase.types.ts supabase/functions/_backend/utils/supabase.types.ts; then | |
| echo "No schema/types drift detected." | |
| exit 0 | |
| fi | |
| git config --local user.name "github-actions[bot]" | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git add supabase/schemas/prod.sql src/types/supabase.types.ts supabase/functions/_backend/utils/supabase.types.ts | |
| git commit -m "chore(auto-sync): update supabase schema and generated types [skip ci]" | |
| remote_repo="https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | |
| git push "$remote_repo" HEAD:main |