From cc4961cc51a521bbe49388c74115de75d486ef60 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Sun, 6 Aug 2023 14:50:44 +0100 Subject: [PATCH 1/2] chore: use release-please for releases To enable releasing an RC with the new version of libp2p, switch to gated releases using release-please - config borrowed from libp2p. --- .github/workflows/main.yml | 115 +++++++++++++++++++------------- .release-please-manifest.json | 4 ++ .release-please.json | 10 +++ package.json | 8 ++- packages/helia/package.json | 91 +------------------------ packages/helia/typedoc.json | 5 ++ packages/interface/package.json | 91 +------------------------ packages/interface/typedoc.json | 7 ++ packages/interop/package.json | 5 +- typedoc.json | 14 +--- 10 files changed, 105 insertions(+), 245 deletions(-) create mode 100644 .release-please-manifest.json create mode 100644 .release-please.json create mode 100644 packages/helia/typedoc.json create mode 100644 packages/interface/typedoc.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 51686414c..159a519c4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,13 +1,25 @@ -name: test & maybe release +name: ci on: push: branches: - main pull_request: + branches: + - '**' jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: lts/* + - uses: ipfs/aegir/actions/cache-node-modules@master + check: + needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -17,9 +29,10 @@ jobs: - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present lint - run: npm run --if-present dep-check + - run: npm run --if-present doc-check test-node: - needs: check + needs: build runs-on: ${{ matrix.os }} strategy: matrix: @@ -33,12 +46,12 @@ jobs: node-version: ${{ matrix.node }} - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:node - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: node test-chrome: - needs: check + needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -47,12 +60,12 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:chrome - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: chrome test-chrome-webworker: - needs: check + needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -61,12 +74,12 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:chrome-webworker - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: chrome-webworker test-firefox: - needs: check + needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -75,12 +88,12 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:firefox - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: firefox test-firefox-webworker: - needs: check + needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -89,18 +102,13 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:firefox-webworker - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: firefox-webworker test-webkit: - needs: check - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - node: [lts/*] - fail-fast: true + needs: build + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -108,31 +116,12 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:webkit - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: webkit - test-webkit-webworker: - needs: check - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - node: [lts/*] - fail-fast: true - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run --if-present test:webkit-webworker - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: webkit-webworker - test-electron-main: - needs: check + needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -141,12 +130,12 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npx xvfb-maybe npm run --if-present test:electron-main - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: electron-main test-electron-renderer: - needs: check + needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -155,15 +144,39 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npx xvfb-maybe npm run --if-present test:electron-renderer - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: electron-renderer release: - needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-webkit, test-webkit-webworker, test-electron-main, test-electron-renderer] runs-on: ubuntu-latest + needs: [ + test-node, + test-chrome, + test-chrome-webworker, + test-firefox, + test-firefox-webworker, + test-electron-main, + test-electron-renderer + ] if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: + - uses: GoogleCloudPlatform/release-please-action@v2 + id: release + with: + token: ${{ secrets.GITHUB_TOKEN }} + command: manifest + release-type: node + manifest-file: .release-please-manifest.json + config-file: .release-please.json + changelog-types: | + [ + { "type": "feat", "section": "Features", "hidden": false }, + { "type": "fix", "section": "Bug Fixes", "hidden": false }, + { "type": "chore", "section": "Trivial Changes", "hidden": false }, + { "type": "docs", "section": "Documentation", "hidden": false }, + { "type": "deps", "section": "Dependencies", "hidden": false } + ] - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -175,7 +188,19 @@ jobs: with: docker-token: ${{ secrets.DOCKER_TOKEN }} docker-username: ${{ secrets.DOCKER_USERNAME }} - - run: npm run --if-present release + - if: ${{ steps.release.outputs.releases_created }} + name: Run release version + run: | + git update-index --assume-unchanged packages/helia/src/version.ts + npm run --if-present release + env: + GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN || github.token }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - if: ${{ !steps.release.outputs.releases_created }} + name: Run release rc + run: | + git update-index --assume-unchanged packages/helia/src/version.ts + npm run --if-present release:rc env: GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN || github.token }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 000000000..e18952ba8 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,4 @@ +{ + "packages/helia":"1.3.12", + "packages/interface":"1.2.2" +} \ No newline at end of file diff --git a/.release-please.json b/.release-please.json new file mode 100644 index 000000000..16fedc1ac --- /dev/null +++ b/.release-please.json @@ -0,0 +1,10 @@ +{ + "plugins": ["node-workspace"], + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "group-pull-request-title-pattern": "chore: release ${component}", + "packages": { + "packages/helia": {}, + "packages/interface": {} + } +} diff --git a/package.json b/package.json index 6ee64e377..53f96d89e 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,12 @@ "generate": "aegir run generate", "build": "aegir run build", "lint": "aegir run lint", - "docs": "NODE_OPTIONS=--max_old_space_size=4096 aegir docs", - "docs:no-publish": "NODE_OPTIONS=--max_old_space_size=4096 aegir docs --publish false", "dep-check": "aegir run dep-check", - "release": "npm run docs:no-publish && aegir run release && npm run docs" + "release": "run-s build docs:no-publish npm:release docs", + "npm:release": "aegir exec --bail false npm -- publish", + "release:rc": "aegir release-rc", + "docs": "NODE_OPTIONS=--max_old_space_size=8192 aegir docs -- --exclude packages/interop --excludeExternals", + "docs:no-publish": "NODE_OPTIONS=--max_old_space_size=8192 aegir docs --publish false -- --exclude packages/interop" }, "devDependencies": { "aegir": "^40.0.8", diff --git a/packages/helia/package.json b/packages/helia/package.json index d289faf1f..d39c84efa 100644 --- a/packages/helia/package.json +++ b/packages/helia/package.json @@ -34,91 +34,6 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", @@ -131,8 +46,7 @@ "test:firefox-webworker": "aegir test -t webworker -- --browser firefox", "test:node": "aegir test -t node --cov", "test:electron-main": "aegir test -t electron-main", - "prepublishOnly": "node scripts/update-version.js && npm run build", - "release": "aegir release" + "prepublishOnly": "node scripts/update-version.js && npm run build" }, "dependencies": { "@chainsafe/libp2p-gossipsub": "^8.0.0", @@ -185,8 +99,5 @@ }, "browser": { "./dist/src/utils/libp2p-defaults.js": "./dist/src/utils/libp2p-defaults.browser.js" - }, - "typedoc": { - "entryPoint": "./src/index.ts" } } diff --git a/packages/helia/typedoc.json b/packages/helia/typedoc.json new file mode 100644 index 000000000..f599dc728 --- /dev/null +++ b/packages/helia/typedoc.json @@ -0,0 +1,5 @@ +{ + "entryPoints": [ + "./src/index.ts" + ] +} diff --git a/packages/interface/package.json b/packages/interface/package.json index 5a344b21a..c5c9e052f 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -58,97 +58,11 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", "dep-check": "aegir dep-check", - "build": "aegir build", - "release": "aegir release" + "build": "aegir build" }, "dependencies": { "@libp2p/interface-libp2p": "^3.2.0", @@ -162,8 +76,5 @@ }, "devDependencies": { "aegir": "^40.0.8" - }, - "typedoc": { - "entryPoint": "./src/index.ts" } } diff --git a/packages/interface/typedoc.json b/packages/interface/typedoc.json new file mode 100644 index 000000000..7969f9cdb --- /dev/null +++ b/packages/interface/typedoc.json @@ -0,0 +1,7 @@ +{ + "entryPoints": [ + "./src/index.ts", + "./src/blocks.ts", + "./src/pins.ts" + ] +} diff --git a/packages/interop/package.json b/packages/interop/package.json index 4ca941951..b6bee71e6 100644 --- a/packages/interop/package.json +++ b/packages/interop/package.json @@ -71,8 +71,5 @@ "./dist/test/fixtures/create-kubo.js": "./dist/test/fixtures/create-kubo.browser.js", "go-ipfs": false }, - "private": true, - "typedoc": { - "entryPoint": "./src/index.ts" - } + "private": true } diff --git a/typedoc.json b/typedoc.json index 07be1a9df..b5cbc6721 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,16 +1,4 @@ { "$schema": "https://typedoc.org/schema.json", - "entryPoints": [ - "./packages/helia", - "./packages/interface", - "./packages/interop", - ], - "entryPointStrategy": "packages", - "out": ".docs", - "hideGenerator": true, - "name": "Helia", - "includeVersion": true, - "cleanOutputDir": true, - "logLevel": "Verbose", - "readme": "./README.md", + "name": "Helia" } From 0c552c2b512467f914b58907c07e8db136f20437 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Sun, 6 Aug 2023 14:59:41 +0100 Subject: [PATCH 2/2] chore: update codecov --- .github/workflows/main.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 159a519c4..c78484613 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,7 +46,7 @@ jobs: node-version: ${{ matrix.node }} - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:node - - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: flags: node @@ -60,7 +60,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:chrome - - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: flags: chrome @@ -74,7 +74,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:chrome-webworker - - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: flags: chrome-webworker @@ -88,7 +88,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:firefox - - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: flags: firefox @@ -102,7 +102,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:firefox-webworker - - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: flags: firefox-webworker @@ -116,7 +116,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:webkit - - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: flags: webkit @@ -130,7 +130,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npx xvfb-maybe npm run --if-present test:electron-main - - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: flags: electron-main @@ -144,7 +144,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npx xvfb-maybe npm run --if-present test:electron-renderer - - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: flags: electron-renderer