Skip to content

Commit ed11bce

Browse files
committed
ci: add npm-release workflow
ipfs: check auto-js-ipfs.type directly
1 parent bd049bb commit ed11bce

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

.github/workflows/npm-release.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish Package to npmjs
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
build-release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-node@v3
12+
with:
13+
node-version: '18.x'
14+
registry-url: 'https://registry.npmjs.org'
15+
cache: 'yarn'
16+
17+
- name: Yarn Install
18+
run: yarn install --frozen-lockfile
19+
20+
- name: Yarn Build
21+
run: yarn run build
22+
23+
- run: npm publish
24+
env:
25+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

src/ipfsutils.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Downloader } from "./downloader.js";
44
import * as UnixFS from "@ipld/unixfs";
55
import { CarWriter } from "@ipld/car";
66
import Queue from "p-queue";
7-
import { Web3StorageAPI } from "auto-js-ipfs";
87

98
// eslint-disable-next-line no-undef
109
const autoipfsOpts = {web3StorageToken: __WEB3_STORAGE_TOKEN__};
@@ -38,7 +37,7 @@ export async function ipfsAdd(coll, downloaderOpts = {}, replayOpts = {}, progre
3837
let shardSize;
3938
let capacity;
4039

41-
if (autoipfs instanceof Web3StorageAPI) {
40+
if (autoipfs.type === "web3.storage") {
4241
// for now, web3storage only allows a single-shard uploads, so set this high.
4342
concur = 1;
4443
shardSize = 1024 * 1024 * 10000;
@@ -342,13 +341,6 @@ export const iterate = async function* (stream) {
342341
}
343342
};
344343

345-
// const pipe = async (source, writer) => {
346-
// for await (const item of source) {
347-
// writer.write(item);
348-
// }
349-
// return await writer.close();
350-
// };
351-
352344
export async function encodeBlocks(blocks, root) {
353345
// @ts-expect-error
354346
const { writer, out } = CarWriter.create(root);

0 commit comments

Comments
 (0)