120 lines
2.3 KiB
Jsonnet
120 lines
2.3 KiB
Jsonnet
local bun_image = "oven/bun:1";
|
|
|
|
|
|
local fetch_step = {
|
|
name: "fetch",
|
|
image: "alpine/git",
|
|
commands: ["git fetch --tags"],
|
|
};
|
|
|
|
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 publish_step = {
|
|
// name: "publish",
|
|
// image: "plugins/npm",
|
|
|
|
// settings: {
|
|
// registry: "https://git.jvalver.de/api/packages/thilawyn/npm",
|
|
// token: { from_secret: "npm_token" },
|
|
// },
|
|
// };
|
|
|
|
local publish_step = {
|
|
name: "publish",
|
|
image: "node:14",
|
|
|
|
environment: {
|
|
NPM_TOKEN: { from_secret: "npm_token" }
|
|
},
|
|
|
|
commands: [
|
|
"npm set 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,
|
|
publish_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,
|
|
],
|
|
},
|
|
]
|