ci: initial experiment with ci build
parent
76b2676f38
commit
64cb4774ea
@ -0,0 +1,31 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: node:16.18-bullseye
|
||||
commands:
|
||||
- apt-get update
|
||||
- apt-get install -y cmake jq zip
|
||||
- ./scripts/build-wasm.sh
|
||||
- npm ci
|
||||
- npm run test
|
||||
- ./scripts/build-and-package.sh modern
|
||||
- ./scripts/build-and-package.sh legacy
|
||||
- ./scripts/build-and-package.sh extension
|
||||
- sha256sum *.zip > sha256sum.txt
|
||||
|
||||
- name: upload
|
||||
image: plugins/s3
|
||||
settings:
|
||||
bucket: um-web
|
||||
access_key:
|
||||
from_secret: S3_ACCESS_KEY
|
||||
secret_key:
|
||||
from_secret: S3_SECRET_KEY
|
||||
source: |
|
||||
*.zip
|
||||
sha256sum.txt
|
||||
target: /${DRONE_COMMIT_BRANCH}-latest
|
@ -1,25 +1,25 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const src = "./src/extension/"
|
||||
const dst = "./dist"
|
||||
fs.readdirSync(src).forEach(file => {
|
||||
let srcPath = path.join(src, file)
|
||||
let dstPath = path.join(dst, file)
|
||||
fs.copyFileSync(srcPath, dstPath)
|
||||
console.log(`Copy: ${srcPath} => ${dstPath}`)
|
||||
})
|
||||
|
||||
const manifestRaw = fs.readFileSync("./extension-manifest.json", "utf-8")
|
||||
const manifest = JSON.parse(manifestRaw)
|
||||
|
||||
const pkgRaw = fs.readFileSync("./package.json", "utf-8")
|
||||
const pkg = JSON.parse(pkgRaw)
|
||||
|
||||
verExt = pkg["version"]
|
||||
if (verExt.startsWith("v")) verExt = verExt.slice(1)
|
||||
if (verExt.includes("-")) verExt = verExt.split("-")[0]
|
||||
manifest["version"] = `${verExt}.${pkg["ext_build"]}`
|
||||
manifest["version_name"] = pkg["version"]
|
||||
|
||||
fs.writeFileSync("./dist/manifest.json", JSON.stringify(manifest), "utf-8")
|
||||
console.log("Write: manifest.json")
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const src = __dirname + "/src/extension/"
|
||||
const dst = __dirname + "/dist"
|
||||
fs.readdirSync(src).forEach(file => {
|
||||
let srcPath = path.join(src, file)
|
||||
let dstPath = path.join(dst, file)
|
||||
fs.copyFileSync(srcPath, dstPath)
|
||||
console.log(`Copy: ${srcPath} => ${dstPath}`)
|
||||
})
|
||||
|
||||
const manifestRaw = fs.readFileSync(__dirname + "/extension-manifest.json", "utf-8")
|
||||
const manifest = JSON.parse(manifestRaw)
|
||||
|
||||
const pkgRaw = fs.readFileSync(__dirname + "/package.json", "utf-8")
|
||||
const pkg = JSON.parse(pkgRaw)
|
||||
|
||||
verExt = pkg["version"]
|
||||
if (verExt.startsWith("v")) verExt = verExt.slice(1)
|
||||
if (verExt.includes("-")) verExt = verExt.split("-")[0]
|
||||
manifest["version"] = `${verExt}.${pkg["ext_build"]}`
|
||||
manifest["version_name"] = pkg["version"]
|
||||
|
||||
fs.writeFileSync(__dirname + "/dist/manifest.json", JSON.stringify(manifest), "utf-8")
|
||||
console.log("Write: manifest.json")
|
||||
|
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
VERSION="$(jq -r ".version" <package.json)"
|
||||
DIST_NAME="um-web.$1.${VERSION}"
|
||||
|
||||
case "$1" in
|
||||
"modern") npm run build -- --modern ;;
|
||||
"legacy") npm run build ;;
|
||||
"extension") npm run make-extension ;;
|
||||
|
||||
*)
|
||||
echo "Unknown command: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
mv dist "${DIST_NAME}"
|
||||
zip -rJ9 "${DIST_NAME}.zip" "${DIST_NAME}"
|
||||
rm -rf "${DIST_NAME}"
|
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
pushd ./src/QmcWasm
|
||||
bash build-wasm
|
Loading…
Reference in New Issue