diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ef1f720cb8..00d5752106 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -309,6 +309,7 @@ jobs: yarn install yarn build cp ../../README.md . + cp ../../CHANGELOG.md . if [ ${{ contains(github.ref, '-') }} = "true" ]; then yarn npm publish --tag rc else diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 426bcc3642..1fe0423585 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -152,3 +152,45 @@ jobs: printf "Checking MSRV for $package..." cargo msrv --output-format json --path "$package" verify | tail -n 1 | jq --exit-status '.success' done + + tarball: + name: Check NodeJS tarball + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install node + uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: "https://registry.npmjs.org" + - name: Validate the files in the tarball + shell: bash + working-directory: npm/git-cliff + run: | + yarn install + yarn build + cp ../../README.md . + cp ../../CHANGELOG.md . + + files_expected_in_tarball=( + "CHANGELOG.md" + "README.md" + "lib/cjs/index.cjs" + "lib/cjs/index.cjs.map" + "lib/cjs/index.d.cts" + "lib/cli/cli.js" + "lib/esm/index.d.ts" + "lib/esm/index.js" + "lib/esm/index.js.map" + "package.json" + ) + + tarball_output=$(yarn pack --dry-run) + + for file in "${files_expected_in_tarball[@]}"; do + if [[ ! "$tarball_output" == *"$file"* ]]; then + echo "Error: Expected file '$file' not found in tarball." + exit 1 + fi + done diff --git a/npm/git-cliff/package.json b/npm/git-cliff/package.json index e9b42a28b3..e1d35e93e8 100644 --- a/npm/git-cliff/package.json +++ b/npm/git-cliff/package.json @@ -22,6 +22,9 @@ } } }, + "files": [ + "lib" + ], "scripts": { "typecheck": "tsc", "lint": "eslint .", diff --git a/npm/git-cliff/yarn.lock b/npm/git-cliff/yarn.lock index a3e644c78b..75708cce1c 100644 --- a/npm/git-cliff/yarn.lock +++ b/npm/git-cliff/yarn.lock @@ -1371,44 +1371,44 @@ __metadata: languageName: node linkType: hard -"git-cliff-darwin-arm64@npm:2.1.0-rc.0": - version: 2.1.0-rc.0 - resolution: "git-cliff-darwin-arm64@npm:2.1.0-rc.0" +"git-cliff-darwin-arm64@npm:2.2.0": + version: 2.2.0 + resolution: "git-cliff-darwin-arm64@npm:2.2.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"git-cliff-darwin-x64@npm:2.1.0-rc.0": - version: 2.1.0-rc.0 - resolution: "git-cliff-darwin-x64@npm:2.1.0-rc.0" +"git-cliff-darwin-x64@npm:2.2.0": + version: 2.2.0 + resolution: "git-cliff-darwin-x64@npm:2.2.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"git-cliff-linux-arm64@npm:2.1.0-rc.0": - version: 2.1.0-rc.0 - resolution: "git-cliff-linux-arm64@npm:2.1.0-rc.0" +"git-cliff-linux-arm64@npm:2.2.0": + version: 2.2.0 + resolution: "git-cliff-linux-arm64@npm:2.2.0" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"git-cliff-linux-x64@npm:2.1.0-rc.0": - version: 2.1.0-rc.0 - resolution: "git-cliff-linux-x64@npm:2.1.0-rc.0" +"git-cliff-linux-x64@npm:2.2.0": + version: 2.2.0 + resolution: "git-cliff-linux-x64@npm:2.2.0" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"git-cliff-windows-arm64@npm:2.1.0-rc.0": - version: 2.1.0-rc.0 - resolution: "git-cliff-windows-arm64@npm:2.1.0-rc.0" +"git-cliff-windows-arm64@npm:2.2.0": + version: 2.2.0 + resolution: "git-cliff-windows-arm64@npm:2.2.0" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"git-cliff-windows-x64@npm:2.1.0-rc.0": - version: 2.1.0-rc.0 - resolution: "git-cliff-windows-x64@npm:2.1.0-rc.0" +"git-cliff-windows-x64@npm:2.2.0": + version: 2.2.0 + resolution: "git-cliff-windows-x64@npm:2.2.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -1422,12 +1422,12 @@ __metadata: "@typescript-eslint/parser": "npm:^7.1.0" eslint: "npm:^8.57.0" execa: "npm:^8.0.1" - git-cliff-darwin-arm64: "npm:2.1.0-rc.0" - git-cliff-darwin-x64: "npm:2.1.0-rc.0" - git-cliff-linux-arm64: "npm:2.1.0-rc.0" - git-cliff-linux-x64: "npm:2.1.0-rc.0" - git-cliff-windows-arm64: "npm:2.1.0-rc.0" - git-cliff-windows-x64: "npm:2.1.0-rc.0" + git-cliff-darwin-arm64: "npm:2.2.0" + git-cliff-darwin-x64: "npm:2.2.0" + git-cliff-linux-arm64: "npm:2.2.0" + git-cliff-linux-x64: "npm:2.2.0" + git-cliff-windows-arm64: "npm:2.2.0" + git-cliff-windows-x64: "npm:2.2.0" tsup: "npm:^8.0.2" typescript: "npm:^5.3.3" dependenciesMeta: diff --git a/release.sh b/release.sh index ff741cba1c..4b8038e984 100755 --- a/release.sh +++ b/release.sh @@ -16,6 +16,7 @@ msg="# managed by release.sh" sed -E -i "s/^version = .* $msg$/version = \"${1#v}\" $msg/" git-cliff*/Cargo.toml sed -E -i "s/\"version\": \".+\"/\"version\": \"${1#v}\"/" npm/git-cliff/package.json sed -E -i "s/\"(git-cliff-.+)\": \".+\"/\"\1\": \"${1#v}\"/g" npm/git-cliff/package.json +pushd npm/git-cliff && yarn install && popd # update the changelog cargo run -- --config cliff.toml --tag "$1" >CHANGELOG.md git add -A && git commit -m "chore(release): prepare for $1"