Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: add automation for updating postject dependency #46157

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/tools.yml
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions doc/contributing/maintaining-postject.md
@@ -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.
```
20 changes: 20 additions & 0 deletions tools/dep_updaters/README.md
Expand Up @@ -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.
22 changes: 22 additions & 0 deletions tools/dep_updaters/update-postject.sh
@@ -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