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

fix: Revert "chore(release): remove goreleaser" #9908

Merged
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: 13 additions & 3 deletions .github/workflows/turborepo-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,15 @@ 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 @@ -224,13 +233,14 @@ 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-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
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

- 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: 2 additions & 1 deletion cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ publish-turbo: build
npm config set --location=project "//registry.npmjs.org/:_authToken" $(NPM_TOKEN)

# Publishes the native npm modules.
turbo release-native -- $(SKIP_PUBLISH)
# TODO: do this without goreleaser.
goreleaser release --rm-dist -f combined-shim.yml $(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: 78 additions & 0 deletions cli/combined-shim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
project_name: turbo

dist: dist

builds:
- id: turbo
builder: prebuilt
tags:
- rust
- staticbinary
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
goamd64:
- v1
prebuilt:
path: dist-{{ .Os }}-{{ .Arch }}/turbo{{ .Ext }}
hooks:
pre:
- cmd: ./scripts/npm-native-packages/npm-native-packages.js {{ .Os }} {{ .Arch }} {{ .Version }}
binary: bin/turbo
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}"
archives:
- id: github
name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
wrap_in_directory: true
replacements:
amd64: 64
format: tar.gz
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
- README.md
- id: npm
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
wrap_in_directory: true
replacements:
amd64: 64
format: tar.gz
files:
- LICENSE
- src: "scripts/npm-native-packages/build/{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}/package.json"
dst: "workaround/.."
strip_parent: true
- src: "scripts/npm-native-packages/build/{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}/README.md"
dst: "workaround/.."
strip_parent: true
- src: "scripts/npm-native-packages/build/{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}/bin/*"
dst: "bin/"
strip_parent: true
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
release:
github:
owner: vercel
name: turborepo
ids:
- github
prerelease: auto
disable: true
publishers:
- name: npm
ids:
- npm
cmd: "npm publish{{ if .Prerelease }} --tag canary{{ end }} {{ abs .ArtifactPath }}"
6 changes: 1 addition & 5 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"scripts": {
"clean": "cargo clean --package turbo",
"build": "cargo build --package turbo",
"build:release": "cargo build --package turbo --profile release-turborepo",
"release-native": "turboreleaser --version-path ../version.txt"
},
"dependencies": {
"@turbo/releaser": "workspace:*"
"build:release": "cargo build --package turbo --profile release-turborepo"
}
}
1 change: 1 addition & 0 deletions cli/scripts/npm-native-packages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
51 changes: 51 additions & 0 deletions cli/scripts/npm-native-packages/npm-native-packages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env node

const fs = require("fs");
const path = require("path");

// Map to node os and arch names.
const nodeOsLookup = {
darwin: "darwin",
linux: "linux",
windows: "win32",
};

const nodeArchLookup = {
amd64: "x64",
arm64: "arm64",
};

const humanizedArchLookup = {
amd64: "64",
arm64: "arm64",
};

const template = require("./template/template.package.json");
const os = process.argv[2];
const arch = process.argv[3];
const version = process.argv[4];

template.name = `turbo-${os}-${humanizedArchLookup[arch]}`;
template.description = `The ${os}-${humanizedArchLookup[arch]} binary for turbo, a monorepo build system.`;
template.os = [nodeOsLookup[os]];
template.cpu = [nodeArchLookup[arch]];
template.version = version;

const outputPath = path.join(__dirname, "build", template.name);
fs.rmSync(outputPath, { recursive: true, force: true });
fs.mkdirSync(path.join(outputPath, "bin"), { recursive: true });

if (os === "windows") {
fs.copyFileSync(
path.join(__dirname, "template", "bin", "turbo"),
path.join(outputPath, "bin", "turbo")
);
}
fs.copyFileSync(
path.join(__dirname, "template", "README.md"),
path.join(outputPath, "README.md")
);
fs.writeFileSync(
path.join(outputPath, "package.json"),
JSON.stringify(template, null, 2)
);
12 changes: 12 additions & 0 deletions cli/scripts/npm-native-packages/template/template.package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "turbo-{{Os}}-{{Arch}}",
"version": "{{Version}",
"description": "The {{Os}}-{{Arch}} binary for turbo, a monorepo build system.",
"repository": "https://github.com/vercel/turborepo",
"bugs": "https://github.com/vercel/turborepo/issues",
"homepage": "https://turbo.build/repo",
"license": "MIT",
"os": ["{{Os}}"],
"cpu": ["{{Arch}}"],
"preferUnplugged": true
}
4 changes: 0 additions & 4 deletions cli/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY"
]
},
"release-native": {
"dependsOn": ["@turbo/releaser#build"],
"cache": false
}
}
}
26 changes: 0 additions & 26 deletions packages/turbo-releaser/.eslintrc.js

This file was deleted.

20 changes: 0 additions & 20 deletions packages/turbo-releaser/cli/index.cjs

This file was deleted.

32 changes: 0 additions & 32 deletions packages/turbo-releaser/package.json

This file was deleted.

45 changes: 0 additions & 45 deletions packages/turbo-releaser/src/index.ts

This file was deleted.

Loading
Loading