From 4ea471deeb24730b5c94a65f1c73419530cede10 Mon Sep 17 00:00:00 2001 From: Garry O'Donnell Date: Tue, 29 Oct 2024 09:35:10 +0000 Subject: [PATCH] Use graph-federation workflows for graph composition and update --- .../workflows/_supergraph_composition.yaml | 51 ------------------- .github/workflows/ci.yaml | 19 ++++--- 2 files changed, 9 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/_supergraph_composition.yaml diff --git a/.github/workflows/_supergraph_composition.yaml b/.github/workflows/_supergraph_composition.yaml deleted file mode 100644 index 57224c30..00000000 --- a/.github/workflows/_supergraph_composition.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: Compose Supergraph Schema - -on: - workflow_call: - -jobs: - compose_supergraph: - runs-on: ubuntu-latest - steps: - - name: Checkout Graph Federation source - uses: actions/checkout@v4.2.2 - with: - repository: DiamondLightSource/graph-federation - - - name: Download Subgraph schema - uses: actions/download-artifact@v4.1.8 - with: - name: graph-proxy - path: schema/ - - - name: Add Subgraph workflows to Supergraph config - run: > - yq -i - ' - .subgraphs.workflows={ - "routing_url":"https://workflows.diamond.ac.uk/graphql", - "schema":{ - "file":"schema/workflows.graphql" - } - } - ' - supergraph-config.yaml - - - name: Install Rover CLI - run: | - curl -sSL https://rover.apollo.dev/nix/latest | sh - echo "$HOME/.rover/bin" >> $GITHUB_PATH - - - name: Compose Supergraph Schema - run: > - rover supergraph compose - --config supergraph-config.yaml - --elv2-license=accept - > supergraph.graphql - - - name: Upload Supergraph Artifact - uses: actions/upload-artifact@v4.4.3 - with: - name: supergraph - path: ./supergraph.graphql - diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 378e0f47..a9e7ac34 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,19 +49,18 @@ jobs: contents: read packages: write - supergraph_composition: + supergraph: # Deduplicate jobs from pull requests and branch pushes within the same repo. if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository needs: graph_proxy_schema - uses: ./.github/workflows/_supergraph_composition.yaml - - supergraph_update: - # Only update the supergraph on releases (tagged pushes to main) - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - needs: supergraph_composition - uses: ./.github/workflows/_supergraph_update.yaml - secrets: - GRAPH_FEDERATOR: ${{ secrets.GRAPH_FEDERATOR }} + uses: diamondlightsource/graph-federation/workflows/update@v0.1.0 + with: + name: workflows + routing-url: https://workflows.diamond.ac.uk/graphql + subgraph-schema-artifact: graph-proxy + subgraph-schema-filename: workflows.graphql + github-app-id: 1010045 + github-app-private-key: ${{ secrets.GRAPH_FEDERATOR }} frontend_code: # Deduplicate jobs from pull requests and branch pushes within the same repo.