Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): remove goreleaser #9905

Merged
merged 6 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions .github/workflows/turborepo-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,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:
Expand All @@ -233,14 +224,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
Expand Down
3 changes: 1 addition & 2 deletions cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ publish-turbo: build
npm config set --location=project "//registry.npmjs.org/:_authToken" $(NPM_TOKEN)

# Publishes the native npm modules.
# TODO: do this without goreleaser.
goreleaser release --rm-dist -f combined-shim.yml $(SKIP_PUBLISH)
turbo release-native -- $(SKIP_PUBLISH)

# Split packing from the publish step so that npm locates the correct .npmrc file.
cd $(CLI_DIR)/../packages/turbo && pnpm pack --pack-destination=$(CLI_DIR)/../
Expand Down
78 changes: 0 additions & 78 deletions cli/combined-shim.yml

This file was deleted.

6 changes: 5 additions & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"scripts": {
"clean": "cargo clean --package turbo",
"build": "cargo build --package turbo",
"build:release": "cargo build --package turbo --profile release-turborepo"
"build:release": "cargo build --package turbo --profile release-turborepo",
"release-native": "turboreleaser --version-path ../version.txt"
},
"dependencies": {
"@turbo/releaser": "workspace:*"
}
}
1 change: 0 additions & 1 deletion cli/scripts/npm-native-packages/.gitignore

This file was deleted.

51 changes: 0 additions & 51 deletions cli/scripts/npm-native-packages/npm-native-packages.js

This file was deleted.

12 changes: 0 additions & 12 deletions cli/scripts/npm-native-packages/template/template.package.json

This file was deleted.

4 changes: 4 additions & 0 deletions cli/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY"
]
},
"release-native": {
"dependsOn": ["@turbo/releaser#build"],
"cache": false
}
}
}
26 changes: 26 additions & 0 deletions packages/turbo-releaser/.eslintrc.js
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",
},
},
],
};
20 changes: 20 additions & 0 deletions packages/turbo-releaser/cli/index.cjs
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);
}
32 changes: 32 additions & 0 deletions packages/turbo-releaser/package.json
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"
}
}
45 changes: 45 additions & 0 deletions packages/turbo-releaser/src/index.ts
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);
});
Loading
Loading