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

feat: Setup semantic-release for rules_task #574

Merged
merged 11 commits into from
Oct 5, 2023
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
7 changes: 3 additions & 4 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"nodePackages.prettier@3.0.3",
"buildifier@5.1.0",
"black@23.9.1",
"lefthook@1.4.8"
"lefthook@1.4.8",
"nodePackages.pnpm@8.7.5"
],
"shell": {
"init_hook": ["alias bazel='bazelisk'"],
"scripts": {
"test": ["echo \"Error: no test specified\" && exit 1"]
}
"scripts": {}
}
}
14 changes: 14 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
"source": "devbox-search",
"version": "1.4.8"
},
"nodePackages.pnpm@8.7.5": {
"last_modified": "2023-09-16T18:11:59Z",
"resolved": "github:NixOS/nixpkgs/b2e813ada825ef491546ea81f42ef2d37ce71bf6#nodePackages.pnpm",
"source": "devbox-search",
"version": "8.7.5",
"systems": {
"aarch64-linux": {
"store_path": "/nix/store/dn93vz8nqqln96r0r45f353jc7fnf48n-pnpm-8.7.5"
},
"x86_64-linux": {
"store_path": "/nix/store/bj41725jfc23pz1pz6h56y04l4699zhn-pnpm-8.7.5"
}
}
},
"nodePackages.prettier@3.0.3": {
"last_modified": "2023-09-17T10:54:49Z",
"resolved": "github:NixOS/nixpkgs/5148520bfab61f99fd25fb9ff7bfbb50dad3c9db#nodePackages.prettier",
Expand Down
13 changes: 13 additions & 0 deletions rules/rules_task/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Ignore the convenience symlink due to VSCode issue
# fix described here https://github.com/bazelbuild/bazel/issues/10653

bazel-setup
.git
tmp

esphome_nimble/.esphome
esphome_nimble/tmp

node_modules

rules/rules_task
12 changes: 12 additions & 0 deletions rules/rules_task/.releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"branches": [
"master"
],
"extends": "semantic-release-monorepo",
"tagFormat": "rules_task-v${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
}
26 changes: 26 additions & 0 deletions rules/rules_task/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
load("@rules_task//tools:defs.bzl", "compile_pip_requirements")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//:semantic-release/package_json.bzl", semantic_release_bin = "bin")
load(":defs.bzl", "cmd", "task")

package(default_visibility = ["//visibility:public"])

Expand All @@ -13,3 +16,26 @@ compile_pip_requirements(
requirements_in = "requirements.in",
requirements_txt = "requirements.txt",
)

semantic_release_bin.semantic_release_binary(
name = "semantic-release_bin",
log_level = "debug",
)

task(
name = "release",
cmds = [
cmd.shell(
cmd.executable(":semantic-release_bin"),
"$CLI_ARGS",
),
],
cwd = "$(dirname $(readlink -f $RELEASERC))",
env = {
"RELEASERC": cmd.file(".releaserc"),
"BAZEL_BINDIR": ".",
},
)

npm_link_all_packages(
)
26 changes: 25 additions & 1 deletion rules/rules_task/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All the dependencies for rules_task
module(
name = "rules_task",
repo_name = "rules_task",
version = "0.1.0",
version = "0.0.0",
)

bazel_dep(name = "bazel_skylib", version = "1.4.2")
Expand All @@ -31,3 +31,27 @@ pip.parse(
)

use_repo(pip, "pip")

# ------------------------------------ rules_js ------------------------------------ #
bazel_dep(name = "aspect_rules_js", version = "1.32.6")

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
)

npm.npm_translate_lock(
name = "npm",
# Need to configure link_workspace otherwise invocation from setup workspace does not work
link_workspace = "rules_task",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)

use_repo(npm, "npm")

bazel_dep(name = "rules_nodejs", version = "6.0.1")

node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")

node.toolchain(node_version = "18.17.1")
19 changes: 19 additions & 0 deletions rules/rules_task/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "setup",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@semantic-release/commit-analyzer": "9.0.2",
"@semantic-release/github": "8.1.0",
"@semantic-release/release-notes-generator": "10.0.3",
"semantic-release": "^22.0.5",
"semantic-release-monorepo": "^7.0.5"
}
}
Loading