From e6ca09c6e643220ddbf86c327093ef1b95bc75d6 Mon Sep 17 00:00:00 2001 From: Gabriel de Quadros Ligneul <8294320+gligneul@users.noreply.github.com> Date: Tue, 19 Sep 2023 14:41:09 -0300 Subject: [PATCH] feat(graphql): move schema to Github artifact Remove the generated schema from the repository and generate it automatically on the CI. --- .github/workflows/build.yml | 28 ++++++++++++++++++++ CHANGELOG.md | 1 + offchain/{graphql-server => }/schema.graphql | 0 3 files changed, 29 insertions(+) rename offchain/{graphql-server => }/schema.graphql (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe6252fc7..b3b1406a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,6 +68,16 @@ jobs: - name: Run tests run: cargo test + - name: Generate GraphQL schema + run: ./target/debug/generate-schema + + - name: Upload GraphQL schema + uses: actions/upload-artifact@v3 + with: + name: graphql-schema + path: offchain/schema.graphql + if-no-files-found: error + build_docker: runs-on: ubuntu-22.04 needs: @@ -116,3 +126,21 @@ jobs: push: true project: ${{ vars.DEPOT_PROJECT }} workdir: build + + release: + needs: [test, build_docker] + runs-on: ubuntu-22.04 + steps: + - name: Download GraphQL schema + uses: actions/download-artifact@v3 + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + with: + name: graphql-schema + + - name: Upload GraphQL schema to GitHub Release + uses: softprops/action-gh-release@v1 + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + with: + draft: true + files: | + schema.graphql diff --git a/CHANGELOG.md b/CHANGELOG.md index 904e3a42c..5b00164a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Standardized log libraries and configuration +- Moved GraphQL schema generation to the CI. Now it is distributed as a Github artifact ### Removed diff --git a/offchain/graphql-server/schema.graphql b/offchain/schema.graphql similarity index 100% rename from offchain/graphql-server/schema.graphql rename to offchain/schema.graphql