ci: move to jsonnet
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
Sam Therapy 2022-10-27 20:28:12 +02:00
parent 408de72bff
commit 67fb7ff0db
Signed by: sam
GPG key ID: 4D8B07C18F31ACBD
5 changed files with 129 additions and 105 deletions

126
.drone.jsonnet Normal file
View file

@ -0,0 +1,126 @@
local pipe(arch) = {
kind: 'pipeline',
type: 'docker',
name: arch,
platform: {
arch: arch,
},
steps: [
{
name: 'deps',
image: 'node',
commands: [
'curl -L https://pnpm.js.org/pnpm.js | node - add --global pnpm@7',
'pnpm i',
],
},
{
name: 'lint',
image: 'node',
commands: [
'npm run lint:ci',
],
depends_on: [
'deps',
],
},
{
name: 'build',
image: 'node',
commands: [
'npm run build',
],
depends_on: [
'lint',
],
},
],
trigger: {
event: {
exclude: [
'tag',
],
},
},
};
local release(arch) = {
kind: 'pipeline',
type: 'docker',
name: 'release-%s' % [arch],
platform: {
arch: arch,
},
trigger: {
event: [
'tag',
],
},
steps: [
{
name: 'build',
image: 'node:lts',
commands: [
'curl -L https://pnpm.js.org/pnpm.js | node - add --global pnpm@7',
'pnpm i',
'pnpm build',
],
},
{
name: 'package',
image: 'node:lts',
commands: (
if arch == 'arm64' then
[
'wget "https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus2/ldid_linux_aarch64" -O /usr/local/bin/ldid',
'chmod +x /usr/local/bin/ldid',
] else []
) + [
'npm run package -- -t latest-linux-%s,latest-alpine-%s,latest-macos-%s,latest-win-%s -o dist/bin/imagebot-%s' % [arch, arch, arch, arch, arch],
'xz -9 dist/bin/*',
],
depends_on: [
'build',
],
},
{
name: 'release',
image: 'plugins/gitea-release',
settings: {
api_key: {
from_secret: 'release_api_key',
},
base_url: 'https://git.froth.zone',
files: [
'dist/bin/*',
],
},
depends_on: [
'package',
],
} +
(if arch == 'amd64' then
{
name: 'publish',
image: 'plugins/npm',
settings: {
token: {
from_secret: 'release_api_key',
},
registry: 'https://git.froth.zone/api/packages/sam/npm/',
},
depends_on: [
'build',
],
}
else {}),
],
};
[
pipe('amd64'),
pipe('arm64'),
release('amd64'),
release('arm64'),
]

View file

@ -1,103 +0,0 @@
---
kind: pipeline
type: docker
name: Build (amd64)
platform:
arch: amd64
steps:
- name: Get Dependencies
image: node
commands:
- curl -L https://pnpm.js.org/pnpm.js | node - add --global pnpm@7
- pnpm i
- name: Lint
image: node
depends_on:
- Get Dependencies
commands:
- npm run lint:ci
- name: Build
image: node
depends_on:
- Lint
commands:
- npm run build
- name: Package
image: node
depends_on:
- Build
commands:
- npm run package -t latest-linux-x64,latest-alpine-x64,latest-macos-x64,latest-win-x64 -o dist/bin/imagebot-x64
when:
event:
- tag
- name: Make Gitea Release
image: plugins/gitea-release
depends_on:
- Package
settings:
api_key:
from_secret: release_api_key
base_url: https://git.froth.zone
files:
- dist/bin/*
when:
event:
- tag
---
kind: pipeline
type: docker
name: Build (arm64)
platform:
arch: arm64
steps:
- name: Get Dependencies
image: node
commands:
- curl -L https://pnpm.js.org/pnpm.js | node - add --global pnpm@7
- pnpm i
- name: Lint
image: node
depends_on:
- Get Dependencies
commands:
- npm run lint:ci
- name: Build
image: node
depends_on:
- Lint
commands:
- npm run build
- name: Package
image: node
depends_on:
- Build
commands:
- wget "https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus2/ldid_linux_aarch64" -O /usr/local/bin/ldid && chmod +x /usr/local/bin/ldid
- npm run package -t latest-linux-arm64,latest-alpine-arm64,latest-macos-arm64,latest-win-arm64 -o dist/bin/imagebot-arm64
when:
event:
- tag
- name: Make Gitea Release
image: plugins/gitea-release
depends_on:
- Package
settings:
api_key:
from_secret: release_api_key
base_url: https://git.froth.zone
files:
- dist/bin/*
when:
event:
- tag

1
.gitignore vendored
View file

@ -122,4 +122,5 @@ dist
.dccache
config.json
config.jsonc
config.json5
images/*

View file

@ -44,4 +44,4 @@
"files": [
"dist"
]
}
}

View file

@ -1,7 +1,7 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": [
"es6"