diff --git a/.changeset/@graphql-mesh_plugin-jwt-auth-7374-dependencies.md b/.changeset/@graphql-mesh_plugin-jwt-auth-7374-dependencies.md new file mode 100644 index 0000000000000..1dd8c2f447e64 --- /dev/null +++ b/.changeset/@graphql-mesh_plugin-jwt-auth-7374-dependencies.md @@ -0,0 +1,5 @@ +--- +"@graphql-mesh/plugin-jwt-auth": patch +--- +dependencies updates: + - Updated dependency [`@graphql-yoga/plugin-jwt@3.0.1` ↗︎](https://www.npmjs.com/package/@graphql-yoga/plugin-jwt/v/3.0.1) (from `3.0.0`, in `dependencies`) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 85fe821f9574d..0e9ee514bcd87 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -24,3 +24,62 @@ jobs: secrets: githubToken: ${{ secrets.GITHUB_TOKEN }} npmToken: ${{ secrets.NODE_AUTH_TOKEN }} + + ghcr: + runs-on: ubuntu-latest + needs: [release] + if: contains(needs.release.outputs.publishedPackages, '@graphql-mesh/serve-cli') + steps: + - name: version mesh-serve + uses: actions/github-script@v7 + id: ver-mesh-serve + with: + result-encoding: string + script: | + const publishedPackages = ${{ needs.release.outputs.publishedPackages }}; + const meshServe = publishedPackages.find((p) => p.name === '@graphql-mesh/serve-cli'); + if (!meshServe) { + return core.setFailed('@graphql-mesh/serve-cli was not published!'); + } + console.log(meshServe.version); + return meshServe.version; + - name: checkout + uses: actions/checkout@v4 + - name: set up docker buildx + uses: docker/setup-buildx-action@v3 + - name: log in to ghcr + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: set up env + uses: the-guild-org/shared-config/setup@main + with: + nodeVersion: 18 + packageManagerVersion: modern + - name: prepare + run: yarn prebuild + - name: bundle + run: yarn bundle + - name: inject mesh-serve version + run: | + yarn workspace @graphql-mesh/serve-cli inject-version ${{ steps.ver-mesh-serve.outputs.result }} + - name: bake and push + uses: docker/bake-action@v5 + env: + MESH_SERVE_TAGS: ${{ steps.ver-mesh-serve.outputs.result }} + with: + set: | + *.cache-from=type=gha + *.cache-to=type=gha,mode=max + push: true + - name: comment on pr + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: Docker Images + message: | + Published images for this PR are available at: + ``` + ghcr.io/ardatan/mesh-serve:${{ steps.ver-mesh-serve.outputs.result }} + ``` diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 650a0bdbbb403..09bdc64c3a306 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,9 +23,29 @@ jobs: githubToken: ${{ secrets.GUILD_BOT_TOKEN }} npmToken: ${{ secrets.NODE_AUTH_TOKEN }} - docker: + ghcr: runs-on: ubuntu-latest + needs: [stable] + if: contains(needs.stable.outputs.publishedPackages, '@graphql-mesh/serve-cli') steps: + - name: version mesh-serve + uses: actions/github-script@v7 + id: ver-mesh-serve + with: + script: | + const publishedPackages = ${{ needs.stable.outputs.publishedPackages }}; + const meshServe = publishedPackages.find((p) => p.name === '@graphql-mesh/serve-cli'); + if (!meshServe) { + return core.setFailed('@graphql-mesh/serve-cli was not published!'); + } + const { version } = meshServe; + const [major, minor] = version.split('.'); + if (!major || !minor) { + return core.setFailed(`Unknown major or minor in version "${version}"!`); + } + const r = { version, tags: `latest,${major},${major}.${minor},${version}` }; + console.log(r); + return r; - name: checkout uses: actions/checkout@v4 - name: set up docker buildx @@ -36,7 +56,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: setup env + - name: set up env uses: the-guild-org/shared-config/setup@main with: nodeVersion: 18 @@ -45,28 +65,15 @@ jobs: run: yarn prebuild - name: bundle run: yarn bundle - - name: version + - name: inject mesh-serve version run: | - export SHORT_REF="$(git rev-parse --short HEAD)" - echo SHORT_REF="$SHORT_REF" >> $GITHUB_ENV - export REF_NAME=$(echo "${{ github.head_ref || github.ref_name }}" | sed 's/\//_/g') - export VERSIONS="$SHORT_REF,$REF_NAME" - ${{ github.ref == 'refs/heads/master' && 'export VERSIONS="$VERSIONS,latest"' || '' }} - echo VERSIONS="$VERSIONS" >> $GITHUB_ENV + yarn workspace @graphql-mesh/serve-cli inject-version ${{ fromJSON(steps.ver-mesh-serve.outputs.result).version }} - name: bake and push uses: docker/bake-action@v5 + env: + MESH_SERVE_TAGS: ${{ fromJSON(steps.ver-mesh-serve.outputs.result).tags }} with: set: | *.cache-from=type=gha *.cache-to=type=gha,mode=max push: true - - name: comment on pr - if: github.event_name == 'pull_request' - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: Docker Images - message: | - Published images for this PR are available at: - ``` - ghcr.io/ardatan/mesh-serve:${{ env.SHORT_REF }} - ``` diff --git a/docker-bake.hcl b/docker-bake.hcl index cc3405aaf8eed..b5b7c61ec2506 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -2,14 +2,14 @@ group "default" { targets = ["mesh-serve"] } -variable "VERSIONS" { +variable "MESH_SERVE_TAGS" { default = "dev" } target "mesh-serve" { context = "packages/serve-cli" platforms = ["linux/amd64", "linux/arm64"] - tags = formatlist("ghcr.io/ardatan/mesh-serve:%s", split(",", VERSIONS)) + tags = formatlist("ghcr.io/ardatan/mesh-serve:%s", split(",", MESH_SERVE_TAGS)) annotations = [ "org.opencontainers.image.title=\"Mesh Serve\"", "org.opencontainers.image.description=\"GraphQL Gateway by The Guild for anything-to-GraphQL\"", diff --git a/package.json b/package.json index 9ebd9580a17d5..26aac891f642b 100644 --- a/package.json +++ b/package.json @@ -47,9 +47,10 @@ "copy-config-schema": "cp ./packages/legacy/types/src/config-schema.json ./packages/legacy/types/dist/esm && cp ./packages/legacy/types/src/config-schema.json ./packages/legacy/types/dist/cjs", "fix-bin": "node scripts/fix-bin.js", "generate-config-schema": "yarn graphql-to-config-schema --schema ./**/yaml-config.graphql --json ./packages/legacy/types/src/config-schema.json --typings ./packages/legacy/types/src/config.ts --markdown ./website/src/generated-markdown && yarn postgenerate-config-schema", + "inject-version": "yarn workspaces foreach -A run inject-version", "lint": "cross-env \"ESLINT_USE_FLAT_CONFIG=false\" eslint --ext .ts \"./packages/**/src/**/*.ts\"", "loadtest:e2e": "cross-env \"JEST=1\" \"E2E_TEST=true\" jest --no-watchman --runInBand --bail --config=jest.config.loadtest.js", - "postbuild": "yarn workspaces foreach -A run inject-version && yarn copy-config-schema && yarn fix-bin", + "postbuild": "yarn inject-version && yarn copy-config-schema && yarn fix-bin", "postchangeset": "yarn install --no-immutable", "postgenerate-config-schema": "node scripts/create-config-schema-ts.js && npx prettier --write ./packages/legacy/types/src", "postinstall": "husky install && patch-package", diff --git a/packages/serve-cli/package.json b/packages/serve-cli/package.json index a2df2574bf534..f5e66eaa47bcf 100644 --- a/packages/serve-cli/package.json +++ b/packages/serve-cli/package.json @@ -35,7 +35,7 @@ }, "typings": "dist/typings/index.d.ts", "scripts": { - "bundle": "(rm -rf bundle || true) && rollup -c && yarn inject-version", + "bundle": "(rm -rf bundle || true) && rollup -c", "inject-version": "tsx scripts/inject-version.ts" }, "peerDependencies": { diff --git a/packages/serve-cli/scripts/inject-version.ts b/packages/serve-cli/scripts/inject-version.ts index e037d2d8e6cd7..38b0b982d9931 100755 --- a/packages/serve-cli/scripts/inject-version.ts +++ b/packages/serve-cli/scripts/inject-version.ts @@ -2,7 +2,9 @@ import { readFile, writeFile } from 'node:fs/promises'; import { resolve } from 'node:path'; import { fileURLToPath, URL } from 'node:url'; // @ts-expect-error tsx will allow this to work -import { version } from '../package.json'; +import pkg from '../package.json'; + +const version = process.argv[2] || pkg.version; console.log(`Injecting version ${version} to build and bundle`);