tools: add automation for updating postject dependency

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/46157
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
pull/46209/head
Darshan Sen 2023-01-14 13:19:36 +05:30 committed by GitHub
parent 5117c6c9e7
commit d7d9811407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 75 additions and 0 deletions

View File

@ -77,6 +77,16 @@ jobs:
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
./tools/update-undici.sh
fi
- id: postject
subsystem: deps
label: dependencies
run: |
NEW_VERSION=$(npm view postject dist-tags.latest)
CURRENT_VERSION=$(node -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version")
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
./tools/dep_updaters/update-postject.sh
fi
- id: base64
subsystem: deps
label: dependencies

View File

@ -0,0 +1,23 @@
# Maintaining postject
The [postject](https://github.com/nodejs/postject) dependency is used for the
[Single Executable strategic initiative](https://github.com/nodejs/single-executable).
## Updating postject
The `tools/dep_updaters/update-postject.sh` script automates the update of the
postject source files.
Check that Node.js still builds and tests.
## Committing postject
Add postject: `git add --all test/fixtures/postject-copy`
Commit the changes with a message like:
```text
deps: update postject to 1.0.0-alpha.4
Updated as described in doc/contributing/maintaining-postject.md.
```

View File

@ -60,3 +60,23 @@ been created with the changes), do the following:
3. Check that Node.js compiles without errors and the tests pass.
4. Create a commit for the update and in the commit message include the
important/relevant items from the changelog.
## postject
The `update-postject.sh` script downloads postject from the [npm package](http://npmjs.com/package/postject)
and uses it to replace the contents of `test/fixtures/postject-copy`.
In order to update, the following command can be run:
```bash
./tools/dep_updaters/update-postject.sh
```
Once the script has run (either manually, or by CI in which case a PR will have
been created with the changes), do the following:
1. Check the [changelog](https://github.com/nodejs/postject/releases/tag/v1.0.0-alpha.4)
for things that might require changes in Node.js.
2. Check that Node.js compiles without errors and the tests pass.
3. Create a commit for the update and in the commit message include the
important/relevant items from the changelog.

View File

@ -0,0 +1,22 @@
#!/bin/sh
# Shell script to update postject in the source tree to the latest release.
# This script must be in the tools directory when it runs because it uses the
# script source file path to determine directories to work in.
set -ex
cd "$( dirname "$0" )/../.." || exit
rm -rf test/fixtures/postject-copy
mkdir test/fixtures/postject-copy
cd test/fixtures/postject-copy || exit
ROOT="$PWD/../../.."
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
[ -x "$NODE" ] || NODE=$(command -v node)
NPM="$ROOT/deps/npm/bin/npm-cli.js"
"$NODE" "$NPM" init --yes
"$NODE" "$NPM" install --no-bin-links --ignore-scripts postject