| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ca981be commit 6dca79f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -142,12 +142,10 @@ jobs: | |||
| 142 | 142 | subsystem: deps | |
| 143 | 143 | label: dependencies | |
| 144 | 144 | run: | | |
| 145 | - NEW_VERSION=$(gh api repos/nghttp2/nghttp2/releases/latest -q '.tag_name|ltrimstr("v")') | ||
| 146 | - CURRENT_VERSION=$(grep "#define NGHTTP2_VERSION" ./deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h | sed -n "s/^.*VERSION \(.*\)/\1/p") | ||
| 147 | - if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then | ||
| 148 | - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
| 149 | - ./tools/update-nghttp2.sh "$NEW_VERSION" | ||
| 150 | - fi | ||
| 145 | + ./tools/dep_updaters/nghttp2.sh > temp-output | ||
| 146 | + cat temp-output | ||
| 147 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 148 | + rm temp-output | ||
| 151 | 149 | - id: llhttp | |
| 152 | 150 | subsystem: deps | |
| 153 | 151 | label: dependencies | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,16 +13,9 @@ directory and C++ code in the | |||
| 13 | 13 | ||
| 14 | 14 | ## Step 1: Updating nghttp2 | |
| 15 | 15 | ||
| 16 | - The `tools/update-nghttp2.sh` script automates the update of the | ||
| 16 | + The `tools/dep_updaters/update-nghttp2.sh` script automates the update of the | ||
| 17 | 17 | postject source files. | |
| 18 | 18 | ||
| 19 | - In the following examples, `x.y.z` should match the nghttp2 | ||
| 20 | - version to update to. | ||
| 21 | - | ||
| 22 | - ```console | ||
| 23 | - $ ./tools/update-nghttp2.sh x.y.z | ||
| 24 | - ``` | ||
| 25 | - | ||
| 26 | 19 | ## Step 2: Test the build | |
| 27 | 20 | ||
| 28 | 21 | ```console | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,13 +2,27 @@ | |||
| 2 | 2 | set -e | |
| 3 | 3 | # Shell script to update nghttp2 in the source tree to specific version | |
| 4 | 4 | ||
| 5 | - BASE_DIR=$(cd "$(dirname "$0")/.." && pwd) | ||
| 5 | + BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 6 | 6 | DEPS_DIR="$BASE_DIR/deps" | |
| 7 | - NGHTTP2_VERSION=$1 | ||
| 8 | 7 | ||
| 9 | - if [ "$#" -le 0 ]; then | ||
| 10 | - echo "Error: please provide an nghttp2 version to update to" | ||
| 11 | - exit 1 | ||
| 8 | + [ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" | ||
| 9 | + [ -x "$NODE" ] || NODE=$(command -v node) | ||
| 10 | + | ||
| 11 | + NEW_VERSION="$("$NODE" --input-type=module <<'EOF' | ||
| 12 | + const res = await fetch('https://api.github.com/repos/nghttp2/nghttp2/releases/latest'); | ||
| 13 | + if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); | ||
| 14 | + const { tag_name } = await res.json(); | ||
| 15 | + console.log(tag_name.replace('v', '')); | ||
| 16 | + EOF | ||
| 17 | + )" | ||
| 18 | + | ||
| 19 | + CURRENT_VERSION=$(grep "#define NGHTTP2_VERSION" ./deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h | sed -n "s/^.*VERSION \"\(.*\)\"/\1/p") | ||
| 20 | + | ||
| 21 | + echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
| 22 | + | ||
| 23 | + if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| 24 | + echo "Skipped because nghttp2 is on the latest version." | ||
| 25 | + exit 0 | ||
| 12 | 26 | fi | |
| 13 | 27 | ||
| 14 | 28 | echo "Making temporary workspace" | |
@@ -23,16 +37,16 @@ cleanup () { | |||
| 23 | 37 | ||
| 24 | 38 | trap cleanup INT TERM EXIT | |
| 25 | 39 | ||
| 26 | - NGHTTP2_REF="v$NGHTTP2_VERSION" | ||
| 27 | - NGHTTP2_TARBALL="nghttp2-$NGHTTP2_VERSION.tar.gz" | ||
| 40 | + NGHTTP2_REF="v$NEW_VERSION" | ||
| 41 | + NGHTTP2_TARBALL="nghttp2-$NEW_VERSION.tar.gz" | ||
| 28 | 42 | ||
| 29 | 43 | cd "$WORKSPACE" | |
| 30 | 44 | ||
| 31 | 45 | echo "Fetching nghttp2 source archive" | |
| 32 | 46 | curl -sL -o "$NGHTTP2_TARBALL" "https://github.com/nghttp2/nghttp2/releases/download/$NGHTTP2_REF/$NGHTTP2_TARBALL" | |
| 33 | 47 | gzip -dc "$NGHTTP2_TARBALL" | tar xf - | |
| 34 | 48 | rm "$NGHTTP2_TARBALL" | |
| 35 | - mv "nghttp2-$NGHTTP2_VERSION" nghttp2 | ||
| 49 | + mv "nghttp2-$NEW_VERSION" nghttp2 | ||
| 36 | 50 | ||
| 37 | 51 | echo "Removing everything, except lib/ and COPYING" | |
| 38 | 52 | cd nghttp2 | |
@@ -59,5 +73,9 @@ echo "" | |||
| 59 | 73 | echo "Please git add nghttp2, commit the new version:" | |
| 60 | 74 | echo "" | |
| 61 | 75 | echo "$ git add -A deps/nghttp2" | |
| 62 | - echo "$ git commit -m \"deps: update nghttp2 to $NGHTTP2_VERSION\"" | ||
| 76 | + echo "$ git commit -m \"deps: update nghttp2 to $NEW_VERSION\"" | ||
| 63 | 77 | echo "" | |
| 78 | + | ||
| 79 | + # The last line of the script should always print the new version, | ||
| 80 | + # as we need to add it to $GITHUB_ENV variable. | ||
| 81 | + echo "NEW_VERSION=$NEW_VERSION" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments