Skip to content

Commit

Permalink
feat: Setup semantic-release for rules_task (#574)
Browse files Browse the repository at this point in the history
* Setup semantic-release
  • Loading branch information
mvgijssel authored Oct 5, 2023
1 parent 6971346 commit 8986eed
Show file tree
Hide file tree
Showing 8 changed files with 2,772 additions and 5 deletions.
7 changes: 3 additions & 4 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
"[email protected]",
"[email protected]"
],
"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"
},
"[email protected]": {
"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"
}
}
},
"[email protected]": {
"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

0 comments on commit 8986eed

Please sign in to comment.