publish step

This commit is contained in:
DecDuck
2024-10-07 13:40:59 +11:00
parent a038ceafcb
commit cbe7710a87
6 changed files with 24 additions and 36 deletions

View File

@ -2,14 +2,18 @@ stages:
- build
- publish
build:
stage: build
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/rust:1.81.0-bookworm
.parallel-config:
parallel:
matrix:
- TARGET:
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-msvc
build:
stage: build
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/rust:1.81.0-bookworm
extends:
- .parallel-config
script:
- rustup target add $TARGET
- rustup toolchain install stable-$TARGET
@ -24,10 +28,14 @@ build:
- index.d.ts
- droplet.*.node
# publish:
# stage: publish
# image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:21
# script:
# - echo "@drop:registry=https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" > .npmrc
# - echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
# - yarn publish
publish:
stage: publish
dependencies:
- build
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:21
script:
- echo "@drop:registry=https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" > .npmrc
- echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
- yarn
- yarn artifacts
- ls -R ./npm

View File

@ -1,3 +0,0 @@
# `droplet-darwin-x64`
This is the **x86_64-apple-darwin** binary for `droplet`

View File

@ -1,18 +0,0 @@
{
"name": "droplet-darwin-x64",
"version": "0.0.0",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "droplet.darwin-x64.node",
"files": [
"droplet.darwin-x64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,5 +1,5 @@
{
"name": "droplet-linux-x64-gnu",
"name": "@drop/droplet-linux-x64-gnu",
"version": "0.0.0",
"os": [
"linux"

View File

@ -1,5 +1,5 @@
{
"name": "droplet-win32-x64-msvc",
"name": "@drop/droplet-win32-x64-msvc",
"version": "0.0.0",
"os": [
"win32"

View File

@ -8,7 +8,7 @@ use napi::Error;
use std::{
collections::HashMap,
fs::File,
io::{BufRead, BufReader},
io::{self, BufRead, BufReader},
path::Path,
sync::{Arc, Mutex},
};
@ -23,11 +23,12 @@ pub mod manifest;
#[macro_use]
extern crate napi_derive;
fn compress(buffer: &[u8], output_path: &Path, chunk_id: Uuid) {
fn compress(mut buffer: &[u8], output_path: &Path, chunk_id: Uuid) {
let chunk_path = output_path.join(chunk_id.to_string() + ".bin");
let chunk_file = File::create_new(chunk_path).unwrap();
let mut compressor = zstd::Encoder::new(chunk_file, 5).unwrap();
zstd::stream::copy_encode(buffer, chunk_file, 9).unwrap();
io::copy(&mut buffer, &mut compressor).unwrap();
}
#[napi]