Project setup
This commit is contained in:
110
.drone.jsonnet
Normal file
110
.drone.jsonnet
Normal file
@@ -0,0 +1,110 @@
|
||||
local bun_image = "oven/bun:1";
|
||||
local node_image = "node:20";
|
||||
|
||||
|
||||
local install_step = {
|
||||
name: "install",
|
||||
image: bun_image,
|
||||
commands: ["bun install --frozen-lockfile"],
|
||||
};
|
||||
|
||||
local lint_step = {
|
||||
name: "lint",
|
||||
image: bun_image,
|
||||
commands: ["bun lint:tsc"],
|
||||
};
|
||||
|
||||
local build_step = {
|
||||
name: "build",
|
||||
image: bun_image,
|
||||
commands: ["bun run build"],
|
||||
};
|
||||
|
||||
local pack_step = {
|
||||
name: "pack",
|
||||
image: node_image,
|
||||
commands: ["npm pack --dry-run"],
|
||||
};
|
||||
|
||||
local publish_step = {
|
||||
name: "publish",
|
||||
image: node_image,
|
||||
|
||||
environment: {
|
||||
NPM_TOKEN: { from_secret: "npm_token" }
|
||||
},
|
||||
|
||||
commands: [
|
||||
"npm set @thilawyn:registry https://git.jvalver.de/api/packages/thilawyn/npm/",
|
||||
"npm config set -- //git.jvalver.de/api/packages/thilawyn/npm/:_authToken $NPM_TOKEN",
|
||||
"npm publish",
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
[
|
||||
// Lint the whole project when not in master, not in a PR nor on a tag
|
||||
{
|
||||
kind: "pipeline",
|
||||
type: "docker",
|
||||
name: "lint",
|
||||
|
||||
trigger: {
|
||||
ref: {
|
||||
exclude: [
|
||||
"refs/heads/master",
|
||||
"refs/pull/**",
|
||||
"refs/tags/**",
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
steps: [
|
||||
install_step,
|
||||
lint_step,
|
||||
],
|
||||
},
|
||||
|
||||
// Build the package without publishing for pull requests
|
||||
{
|
||||
kind: "pipeline",
|
||||
type: "docker",
|
||||
name: "build",
|
||||
|
||||
trigger: {
|
||||
ref: {
|
||||
include: ["refs/pull/**"]
|
||||
}
|
||||
},
|
||||
|
||||
steps: [
|
||||
install_step,
|
||||
lint_step,
|
||||
build_step,
|
||||
pack_step,
|
||||
],
|
||||
},
|
||||
|
||||
// Build and publish the package for master and tags
|
||||
{
|
||||
kind: "pipeline",
|
||||
type: "docker",
|
||||
name: "build-publish",
|
||||
|
||||
trigger: {
|
||||
ref: {
|
||||
include: [
|
||||
"refs/heads/master",
|
||||
"refs/tags/**",
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
steps: [
|
||||
install_step,
|
||||
lint_step,
|
||||
build_step,
|
||||
publish_step,
|
||||
],
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user