-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,070 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json", | ||
"changelog": [ | ||
"@changesets/changelog-github", | ||
{ "repo": "graphql-hive/gateway" } | ||
], | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [], | ||
"privatePackages": { | ||
"tag": false, | ||
"version": false | ||
}, | ||
"snapshot": { | ||
"useCalculatedVersion": true, | ||
"prereleaseTemplate": "{tag}-{commit}" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-hive/gateway-runtime': major | ||
--- | ||
|
||
Hive Gateway has been moved to a new GitHub repository! You can now find it at [github.com/graphql-hive/gateway](https://github.com/graphql-hive/gateway). |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
dependencies: | ||
if: github.event_name == 'pull_request' && github.event.pull_request.title != 'Upcoming Release Changes' | ||
name: Dependencies | ||
uses: the-guild-org/shared-config/.github/workflows/changesets-dependencies.yml@v1 | ||
with: | ||
node-version-file: .node-version | ||
secrets: | ||
githubToken: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
snapshot: | ||
if: github.event_name == 'pull_request' | ||
name: Snapshot | ||
uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@v1 | ||
with: | ||
node-version-file: .node-version | ||
npmTag: ${{ github.event.pull_request.title == 'Upcoming Release Changes' && 'rc' || 'alpha' }} | ||
restoreDeletedChangesets: ${{ github.event.pull_request.title == 'Upcoming Release Changes' && true || false }} | ||
secrets: | ||
githubToken: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
npmToken: ${{ secrets.NPM_TOKEN }} | ||
stable: | ||
if: github.ref == 'refs/heads/main' | ||
name: Stable | ||
uses: the-guild-org/shared-config/.github/workflows/release-stable.yml@v1 | ||
with: | ||
node-version-file: .node-version | ||
releaseScript: changeset publish | ||
versionScript: changeset version | ||
secrets: | ||
githubToken: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
npmToken: ${{ secrets.NPM_TOKEN }} | ||
ghcr: | ||
name: GitHub Container Registry | ||
runs-on: ubuntu-latest | ||
needs: [stable, snapshot] | ||
if: always() && ( | ||
contains(needs.stable.outputs.publishedPackages, '@graphql-hive/gateway') || | ||
contains(needs.snapshot.outputs.publishedPackages, '@graphql-hive/gateway') | ||
) | ||
steps: | ||
- name: Version | ||
uses: actions/github-script@v7 | ||
id: ver-gateway | ||
with: | ||
script: | | ||
const publishedPackages = ${{ needs.stable.outputs.publishedPackages || needs.snapshot.outputs.publishedPackages }}; | ||
const gateway = publishedPackages.find((p) => p.name === '@graphql-hive/gateway'); | ||
if (!gateway) { | ||
return core.setFailed('@graphql-hive/gateway was not published!'); | ||
} | ||
const { version } = gateway; | ||
let r; | ||
if (context.eventName === 'pull_request') { | ||
r = { version, tags: version }; | ||
} else { | ||
const [major, minor] = version.split('.'); | ||
if (!major || !minor) { | ||
return core.setFailed(`Unknown major or minor in version "${version}"!`); | ||
} | ||
r = { version, tags: `latest,${major},${major}.${minor},${version}` }; | ||
} | ||
console.log(r); | ||
return r; | ||
- 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@v1 | ||
with: | ||
node-version-file: .node-version | ||
- name: Bundle | ||
run: yarn workspace @graphql-hive/gateway bundle | ||
- name: Inject version | ||
run: yarn workspace @graphql-hive/gateway tsx scripts/inject-version ${{ fromJSON(steps.ver-gateway.outputs.result).version }} | ||
- name: Bake and Push | ||
uses: docker/bake-action@v5 | ||
env: | ||
GATEWAY_TAGS: ${{ fromJSON(steps.ver-gateway.outputs.result).tags }} | ||
with: | ||
targets: gateway | ||
set: | | ||
*.cache-from=type=gha | ||
*.cache-to=type=gha,mode=max | ||
push: true | ||
- if: github.event_name == 'pull_request' | ||
name: Comment on PR | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
# match pr comment like with changesets-snapshot-action from the guild's shared-config | ||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
header: snapshot-release-docker-image | ||
message: | | ||
### 🚀 Snapshot Release (Docker Image) | ||
The latest changes of this PR are available as image on GitHub Container Registry (based on the declared `changesets`): | ||
``` | ||
ghcr.io/graphql-hive/gateway:${{ fromJSON(steps.ver-gateway.outputs.result).version }} | ||
``` | ||
bin: | ||
name: Binary built on ${{ matrix.os }} | ||
needs: [stable, snapshot] | ||
if: always() && ( | ||
contains(needs.stable.outputs.publishedPackages, '@graphql-hive/gateway') || | ||
contains(needs.snapshot.outputs.publishedPackages, '@graphql-hive/gateway') | ||
) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-13, macos-14, windows-latest] | ||
steps: | ||
- name: Version | ||
uses: actions/github-script@v7 | ||
id: ver-gateway | ||
with: | ||
script: | | ||
const publishedPackages = ${{ needs.stable.outputs.publishedPackages || needs.snapshot.outputs.publishedPackages }}; | ||
const gateway = publishedPackages.find((p) => p.name === '@graphql-hive/gateway'); | ||
if (!gateway) { | ||
return core.setFailed('@graphql-hive/gateway was not published!'); | ||
} | ||
const { version } = gateway; | ||
console.log({ version }); | ||
return version; | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- if: runner.os == 'Windows' | ||
name: Install Windows SDK | ||
uses: fbactions/setup-winsdk@v2 | ||
with: | ||
# we want exact version because the signtool path depends on it in package-binary.ts | ||
winsdk-build-version: 18362 | ||
- name: Set up env | ||
uses: the-guild-org/shared-config/setup@v1 | ||
with: | ||
node-version-file: .node-version | ||
- name: Bundle | ||
run: yarn workspace @graphql-hive/gateway bundle | ||
- name: Inject version | ||
run: yarn workspace @graphql-hive/gateway tsx scripts/inject-version ${{ steps.ver-gateway.outputs.result }} | ||
- name: Package binary | ||
run: yarn workspace @graphql-hive/gateway tsx scripts/package-binary | ||
- name: Set binary info | ||
id: binary | ||
run: | | ||
echo "name=hive-gateway-${{ runner.os }}-${{ runner.arch }}${{ runner.os == 'Windows' && '.exe' || ''}}" >> ${{ runner.os == 'Windows' && '$ENV:GITHUB_OUTPUT' || '$GITHUB_OUTPUT' }} | ||
echo "path=packages/gateway/hive-gateway${{ runner.os == 'Windows' && '.exe' || '' }}" >> ${{ runner.os == 'Windows' && '$ENV:GITHUB_OUTPUT' || '$GITHUB_OUTPUT' }} | ||
- if: github.ref == 'refs/heads/main' | ||
name: Compress binary | ||
id: compressed-binary | ||
run: | | ||
gzip -9 ${{ steps.binary.outputs.path }} | ||
echo "path=packages/gateway/hive-gateway${{ runner.os == 'Windows' && '.exe.gz' || '.gz' }}" >> ${{ runner.os == 'Windows' && '$ENV:GITHUB_OUTPUT' || '$GITHUB_OUTPUT' }} | ||
- if: github.ref == 'refs/heads/main' | ||
name: Upload release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
tag: hive-gateway@${{ steps.ver-gateway.outputs.result }} | ||
release_name: hive-gateway@${{ steps.ver-gateway.outputs.result }} | ||
asset_name: ${{ steps.binary.outputs.name }} | ||
file: ${{ steps.compressed-binary.outputs.path }} | ||
overwrite: true | ||
- if: github.event_name == 'pull_request' | ||
name: Upload artifact | ||
id: upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.binary.outputs.name }} | ||
path: ${{ steps.binary.outputs.path }} | ||
- if: github.event_name == 'pull_request' | ||
name: Comment on PR | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
# match pr comment like with changesets-snapshot-action from the guild's shared-config | ||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
header: snapshot-release-binary-${{ runner.os }}-${{ runner.arch }} | ||
message: | | ||
### 🚀 Snapshot Release (Binary for `${{ runner.os }}-${{ runner.arch }}`) | ||
The latest changes of this PR are available for download (based on the declared `changesets`). | ||
[![Download](https://custom-icon-badges.demolab.com/badge/-Download-blue?style=for-the-badge&logo=download&logoColor=white "Download")](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload.outputs.artifact-id }}) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
provenance=true |
138 changes: 138 additions & 0 deletions
138
.yarn/patches/@changesets-cli-npm-2.27.9-5df61a909e.patch
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
diff --git a/dist/changesets-cli.cjs.js b/dist/changesets-cli.cjs.js | ||
index 986fdf27f1d85412f8a6b2f5cc026d811ea04372..1f9ce913c42e765c860ca97fff670c2f96c928fb 100644 | ||
--- a/dist/changesets-cli.cjs.js | ||
+++ b/dist/changesets-cli.cjs.js | ||
@@ -666,32 +666,6 @@ function getCorrectRegistry(packageJson) { | ||
return !registry || registry === "https://registry.yarnpkg.com" ? "https://registry.npmjs.org" : registry; | ||
} | ||
|
||
-async function getPublishTool(cwd) { | ||
- const pm = await packageManagerDetector.detect({ | ||
- cwd | ||
- }); | ||
- if (!pm || pm.name !== "pnpm") return { | ||
- name: "npm" | ||
- }; | ||
- | ||
- try { | ||
- let result = await spawn__default["default"]("pnpm", ["--version"], { | ||
- cwd | ||
- }); | ||
- let version = result.stdout.toString().trim(); | ||
- let parsed = semverParse__default["default"](version); | ||
- return { | ||
- name: "pnpm", | ||
- shouldAddNoGitChecks: (parsed === null || parsed === void 0 ? void 0 : parsed.major) === undefined ? false : parsed.major >= 5 | ||
- }; | ||
- } catch (e) { | ||
- return { | ||
- name: "pnpm", | ||
- shouldAddNoGitChecks: false | ||
- }; | ||
- } | ||
-} | ||
- | ||
async function getTokenIsRequired() { | ||
// Due to a super annoying issue in yarn, we have to manually override this env variable | ||
// See: https://github.com/yarnpkg/yarn/issues/2935#issuecomment-355292633 | ||
@@ -783,7 +757,6 @@ let getOtpCode = async twoFactorState => { | ||
// the call being wrapped in the npm request limit and causing the publishes to potentially never run | ||
|
||
async function internalPublish(pkgName, opts, twoFactorState) { | ||
- let publishTool = await getPublishTool(opts.cwd); | ||
let publishFlags = opts.access ? ["--access", opts.access] : []; | ||
publishFlags.push("--tag", opts.tag); | ||
|
||
@@ -792,9 +765,7 @@ async function internalPublish(pkgName, opts, twoFactorState) { | ||
publishFlags.push("--otp", otpCode); | ||
} | ||
|
||
- if (publishTool.name === "pnpm" && publishTool.shouldAddNoGitChecks) { | ||
- publishFlags.push("--no-git-checks"); | ||
- } // Due to a super annoying issue in yarn, we have to manually override this env variable | ||
+ // Due to a super annoying issue in yarn, we have to manually override this env variable | ||
// See: https://github.com/yarnpkg/yarn/issues/2935#issuecomment-355292633 | ||
|
||
|
||
@@ -805,11 +776,9 @@ async function internalPublish(pkgName, opts, twoFactorState) { | ||
code, | ||
stdout, | ||
stderr | ||
- } = publishTool.name === "pnpm" ? await spawn__default["default"]("pnpm", ["publish", "--json", ...publishFlags], { | ||
+ } = await spawn__default["default"]("yarn", ["npm", "publish", ...publishFlags], { | ||
env: Object.assign({}, process.env, envOverride), | ||
cwd: opts.cwd | ||
- }) : await spawn__default["default"](publishTool.name, ["publish", opts.publishDir, "--json", ...publishFlags], { | ||
- env: Object.assign({}, process.env, envOverride) | ||
}); | ||
|
||
if (code !== 0) { | ||
diff --git a/dist/changesets-cli.esm.js b/dist/changesets-cli.esm.js | ||
index f0c19f8f1130425be51c04743abd9f8f078ea840..976a84000179394fff29a180c4de63c67d565154 100644 | ||
--- a/dist/changesets-cli.esm.js | ||
+++ b/dist/changesets-cli.esm.js | ||
@@ -628,32 +628,6 @@ function getCorrectRegistry(packageJson) { | ||
return !registry || registry === "https://registry.yarnpkg.com" ? "https://registry.npmjs.org" : registry; | ||
} | ||
|
||
-async function getPublishTool(cwd) { | ||
- const pm = await detect({ | ||
- cwd | ||
- }); | ||
- if (!pm || pm.name !== "pnpm") return { | ||
- name: "npm" | ||
- }; | ||
- | ||
- try { | ||
- let result = await spawn$1("pnpm", ["--version"], { | ||
- cwd | ||
- }); | ||
- let version = result.stdout.toString().trim(); | ||
- let parsed = semverParse(version); | ||
- return { | ||
- name: "pnpm", | ||
- shouldAddNoGitChecks: (parsed === null || parsed === void 0 ? void 0 : parsed.major) === undefined ? false : parsed.major >= 5 | ||
- }; | ||
- } catch (e) { | ||
- return { | ||
- name: "pnpm", | ||
- shouldAddNoGitChecks: false | ||
- }; | ||
- } | ||
-} | ||
- | ||
async function getTokenIsRequired() { | ||
// Due to a super annoying issue in yarn, we have to manually override this env variable | ||
// See: https://github.com/yarnpkg/yarn/issues/2935#issuecomment-355292633 | ||
@@ -745,7 +719,6 @@ let getOtpCode = async twoFactorState => { | ||
// the call being wrapped in the npm request limit and causing the publishes to potentially never run | ||
|
||
async function internalPublish(pkgName, opts, twoFactorState) { | ||
- let publishTool = await getPublishTool(opts.cwd); | ||
let publishFlags = opts.access ? ["--access", opts.access] : []; | ||
publishFlags.push("--tag", opts.tag); | ||
|
||
@@ -754,9 +727,7 @@ async function internalPublish(pkgName, opts, twoFactorState) { | ||
publishFlags.push("--otp", otpCode); | ||
} | ||
|
||
- if (publishTool.name === "pnpm" && publishTool.shouldAddNoGitChecks) { | ||
- publishFlags.push("--no-git-checks"); | ||
- } // Due to a super annoying issue in yarn, we have to manually override this env variable | ||
+ // Due to a super annoying issue in yarn, we have to manually override this env variable | ||
// See: https://github.com/yarnpkg/yarn/issues/2935#issuecomment-355292633 | ||
|
||
|
||
@@ -767,11 +738,9 @@ async function internalPublish(pkgName, opts, twoFactorState) { | ||
code, | ||
stdout, | ||
stderr | ||
- } = publishTool.name === "pnpm" ? await spawn$1("pnpm", ["publish", "--json", ...publishFlags], { | ||
+ } = await spawn$1("yarn", ["npm", "publish", ...publishFlags], { | ||
env: Object.assign({}, process.env, envOverride), | ||
cwd: opts.cwd | ||
- }) : await spawn$1(publishTool.name, ["publish", opts.publishDir, "--json", ...publishFlags], { | ||
- env: Object.assign({}, process.env, envOverride) | ||
}); | ||
|
||
if (code !== 0) { |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
yarnPath: .yarn/releases/yarn-4.5.1.cjs # TODO: corepack does not work in github actions on windows | ||
nodeLinker: node-modules | ||
npmPublishRegistry: https://registry.npmjs.org | ||
npmAuthToken: ${NPM_TOKEN:-} |
This file contains 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
Oops, something went wrong.