-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): remove goreleaser (#9918)
### Description Third try is the charm. See #9905 and #9909 for details. Additional changes: - Make sure `turbo` binaries are marked as executable. Since they get downloaded via `@actions/download-artifact` which strips permissions: [docs](https://github.com/actions/download-artifact?tab=readme-ov-file#permission-loss) - Correctly set `os: ["win32"]` for the windows package for `turbo-windows-${arch}` ### Testing Instructions Changes from previous PRs: added an e2e test to make sure that the tarball is installable and the included executable is just that.
- Loading branch information
1 parent
ee5dc12
commit ba14fce
Showing
29 changed files
with
771 additions
and
166 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 |
---|---|---|
|
@@ -223,15 +223,6 @@ jobs: | |
git config --global user.name 'Turbobot' | ||
git config --global user.email '[email protected]' | ||
- name: Install GoReleaser | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
distribution: goreleaser-pro | ||
version: v1.18.2 | ||
install-only: true | ||
env: | ||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | ||
|
||
- name: Download Rust artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
|
@@ -242,14 +233,13 @@ jobs: | |
mv rust-artifacts/turbo-aarch64-apple-darwin cli/dist-darwin-arm64 | ||
mv rust-artifacts/turbo-aarch64-unknown-linux-musl cli/dist-linux-arm64 | ||
cp -r rust-artifacts/turbo-x86_64-pc-windows-msvc cli/dist-windows-arm64 | ||
mv rust-artifacts/turbo-x86_64-unknown-linux-musl cli/dist-linux-amd64 | ||
mv rust-artifacts/turbo-x86_64-apple-darwin cli/dist-darwin-amd64 | ||
mv rust-artifacts/turbo-x86_64-pc-windows-msvc cli/dist-windows-amd64 | ||
mv rust-artifacts/turbo-x86_64-unknown-linux-musl cli/dist-linux-x64 | ||
mv rust-artifacts/turbo-x86_64-apple-darwin cli/dist-darwin-x64 | ||
mv rust-artifacts/turbo-x86_64-pc-windows-msvc cli/dist-windows-x64 | ||
- name: Perform Release | ||
run: cd cli && make publish-turbo SKIP_PUBLISH=${{ inputs.dry_run && '--skip-publish' || '' }} | ||
env: | ||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
# Upload published artifacts in case they are needed for debugging later | ||
|
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
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
cli/scripts/npm-native-packages/template/template.package.json
This file was deleted.
Oops, something went wrong.
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
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,26 @@ | ||
module.exports = { | ||
extends: ["@turbo/eslint-config/library"], | ||
overrides: [ | ||
{ | ||
files: ["src/*.ts", "cli/index.cjs"], | ||
rules: { | ||
"no-console": "off", | ||
}, | ||
}, | ||
{ | ||
files: ["src/native.ts", "src/operations.ts"], | ||
rules: { | ||
"import/no-default-export": "off", | ||
}, | ||
}, | ||
{ | ||
files: ["src/*.test.ts"], | ||
rules: { | ||
// https://github.com/nodejs/node/issues/51292 | ||
"@typescript-eslint/no-floating-promises": "off", | ||
"@typescript-eslint/no-unsafe-member-access": "off", | ||
"@typescript-eslint/no-unsafe-argument": "off", | ||
}, | ||
}, | ||
], | ||
}; |
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,20 @@ | ||
#!/usr/bin/env node | ||
|
||
const { spawnSync } = require("node:child_process"); | ||
const path = require("node:path"); | ||
|
||
const PATH_TO_DIST = path.resolve(__dirname, "../dist"); | ||
|
||
// Define the path to the CLI file | ||
const cliPath = path.resolve(__dirname, PATH_TO_DIST, "index.js"); | ||
|
||
try { | ||
const result = spawnSync("node", [cliPath, ...process.argv.slice(2)], { | ||
stdio: "inherit", | ||
}); | ||
|
||
process.exit(result.status); | ||
} catch (error) { | ||
console.error("Error loading turboreleaser CLI, please re-install", error); | ||
process.exit(1); | ||
} |
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,32 @@ | ||
{ | ||
"name": "@turbo/releaser", | ||
"private": true, | ||
"version": "0.0.1", | ||
"bin": { | ||
"turboreleaser": "cli/index.cjs" | ||
}, | ||
"files": [ | ||
"dist", | ||
"template" | ||
], | ||
"scripts": { | ||
"build": "tsup", | ||
"check-types": "tsc --noEmit", | ||
"test": "node --import tsx --test src/*.test.ts", | ||
"lint": "eslint src/", | ||
"lint:prettier": "prettier -c . --cache --ignore-path=../../.prettierignore" | ||
}, | ||
"dependencies": { | ||
"commander": "^11.0.0", | ||
"tar": "6.1.13" | ||
}, | ||
"devDependencies": { | ||
"@turbo/eslint-config": "workspace:*", | ||
"@turbo/tsconfig": "workspace:*", | ||
"@types/node": "^20", | ||
"@types/tar": "^6.1.4", | ||
"typescript": "5.5.4", | ||
"tsup": "^6.7.0", | ||
"tsx": "4.19.1" | ||
} | ||
} |
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,54 @@ | ||
import assert from "node:assert/strict"; | ||
import { test } from "node:test"; | ||
import path from "node:path"; | ||
import { tmpdir, arch as osArch, platform } from "node:os"; | ||
import { mkdir, realpath, rm, writeFile } from "node:fs/promises"; | ||
import { execSync } from "node:child_process"; | ||
import operations from "./operations"; | ||
import type { SupportedOS, SupportedArch } from "./types"; | ||
|
||
test("produces installable archive", async () => { | ||
const tempDir = path.join(await realpath(tmpdir()), "turboreleaser-e2e-test"); | ||
await rm(tempDir, { recursive: true, force: true }); | ||
await mkdir(tempDir, { recursive: true }); | ||
|
||
// Need to match actual values otherwise npm will refuse to run | ||
const os = platform() as SupportedOS; | ||
const arch = osArch() as SupportedArch; | ||
|
||
// make a fake turbo binary | ||
const platformPath = `dist-${os}-${arch}`; | ||
await mkdir(path.join(tempDir, platformPath)); | ||
await writeFile( | ||
path.join(tempDir, platformPath, "turbo"), | ||
"#!/bin/bash\necho Invoked fake turbo!" | ||
); | ||
|
||
const tarPath = await operations.packPlatform({ | ||
platform: { os, arch }, | ||
version: "0.1.2", | ||
srcDir: tempDir, | ||
}); | ||
assert.ok(path.isAbsolute(tarPath)); | ||
|
||
// Make a fake repo to install the tarball in | ||
const fakeRepo = path.join(tempDir, "fake-repo"); | ||
await mkdir(fakeRepo); | ||
await writeFile( | ||
path.join(fakeRepo, "package.json"), | ||
JSON.stringify({ | ||
name: "fake-repo", | ||
scripts: { "test-turbo-install": "turbo" }, | ||
}) | ||
); | ||
execSync(`npm install ${tarPath}`, { cwd: fakeRepo }); | ||
const output = execSync("npm run test-turbo-install", { | ||
stdio: "pipe", | ||
cwd: fakeRepo, | ||
encoding: "utf-8", | ||
}); | ||
assert.equal( | ||
output, | ||
"\n> test-turbo-install\n> turbo\n\nInvoked fake turbo!\n" | ||
); | ||
}); |
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,45 @@ | ||
import { Command } from "commander"; | ||
import { packAndPublish } from "./packager"; | ||
import type { Platform } from "./types"; | ||
import { getVersionInfo } from "./version"; | ||
|
||
const supportedPlatforms: Array<Platform> = [ | ||
{ os: "darwin", arch: "x64" }, | ||
{ os: "darwin", arch: "arm64" }, | ||
{ os: "linux", arch: "x64" }, | ||
{ os: "linux", arch: "arm64" }, | ||
{ os: "windows", arch: "x64" }, | ||
{ os: "windows", arch: "arm64" }, | ||
]; | ||
|
||
const turboReleaser = new Command(); | ||
turboReleaser | ||
.requiredOption("--version-path <path>", "Path to the version.txt file") | ||
.option("--skip-publish", "Skip publishing to NPM") | ||
.action(main); | ||
|
||
async function main(options: { skipPublish: boolean; versionPath: string }) { | ||
console.log("Command line options:", options); | ||
console.log("Supported platforms:", supportedPlatforms); | ||
|
||
try { | ||
const { version, npmTag } = await getVersionInfo(options.versionPath); | ||
console.log(`Using version: ${version}, NPM tag: ${npmTag}`); | ||
|
||
await packAndPublish({ | ||
platforms: supportedPlatforms, | ||
version, | ||
skipPublish: options.skipPublish as boolean, | ||
npmTag, | ||
}); | ||
console.log("Packaging and publishing completed successfully"); | ||
} catch (error) { | ||
console.error("Error during packaging and publishing:", error); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
turboReleaser.parseAsync().catch((reason) => { | ||
console.error("Unexpected error. Please report it as a bug:", reason); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.