GeezerVison is showing github.com — tools: add automation for updating base64 dependency · nodejs/node@75a146f
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: .github/workflows/tools.yml +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -78,11 +78,24 @@ jobs: |
78 | 78 | echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV |
79 | 79 | ./tools/update-undici.sh |
80 | 80 | fi |
| 81 | + - id: base64 |
| 82 | + subsystem: deps |
| 83 | + label: dependencies |
| 84 | + run: | |
| 85 | + NEW_VERSION=$(gh api repos/aklomp/base64/releases/latest -q '.tag_name|ltrimstr("v")') |
| 86 | + CURRENT_VERSION=$(grep "base64 LANGUAGES C VERSION" ./deps/base64/base64/CMakeLists.txt | \ |
| 87 | + sed -n "s/^.*VERSION \(.*\))/\1/p") |
| 88 | + if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then |
| 89 | + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV |
| 90 | + ./tools/update-base64.sh "$NEW_VERSION" |
| 91 | + fi |
81 | 92 | steps: |
82 | 93 | - uses: actions/checkout@v3 |
83 | 94 | with: |
84 | 95 | persist-credentials: false |
85 | 96 | - run: ${{ matrix.run }} |
| 97 | + env: |
| 98 | + GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} |
86 | 99 | - uses: gr2m/create-or-update-pull-request-action@dc1726cbf4dd3ce766af4ec29cfb660e0125e8ee |
87 | 100 | # Creates a PR or update the Action's existing PR, or |
88 | 101 | # no-op if the base branch is already up-to-date. |
|
Collapse file
Copy file name to clipboard +43Lines changed: 43 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +#!/bin/sh |
| 2 | +set -e |
| 3 | +# Shell script to update base64 in the source tree to a specific version |
| 4 | + |
| 5 | +BASE_DIR=$(cd "$(dirname "$0")/.." && pwd) |
| 6 | +DEPS_DIR="$BASE_DIR/deps" |
| 7 | +BASE64_VERSION=$1 |
| 8 | + |
| 9 | +if [ "$#" -le 0 ]; then |
| 10 | + echo "Error: please provide an base64 version to update to" |
| 11 | + echo " e.g. $0 0.4.0" |
| 12 | + exit 1 |
| 13 | +fi |
| 14 | + |
| 15 | +echo "Making temporary workspace" |
| 16 | + |
| 17 | +WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') |
| 18 | + |
| 19 | +cleanup () { |
| 20 | + EXIT_CODE=$? |
| 21 | + [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" |
| 22 | + exit $EXIT_CODE |
| 23 | +} |
| 24 | + |
| 25 | +trap cleanup INT TERM EXIT |
| 26 | + |
| 27 | +cd "$WORKSPACE" |
| 28 | + |
| 29 | +echo "Fetching base64 source archive" |
| 30 | +curl -sL "https://api.github.com/repos/aklomp/base64/tarball/v$BASE64_VERSION" | tar xzf - |
| 31 | +mv aklomp-base64-* base64 |
| 32 | + |
| 33 | +echo "Replacing existing base64" |
| 34 | +rm -rf "$DEPS_DIR/base64/base64" |
| 35 | +mv "$WORKSPACE/base64" "$DEPS_DIR/base64/" |
| 36 | + |
| 37 | +echo "All done!" |
| 38 | +echo "" |
| 39 | +echo "Please git add base64/base64, commit the new version:" |
| 40 | +echo "" |
| 41 | +echo "$ git add -A deps/base64/base64" |
| 42 | +echo "$ git commit -m \"deps: update base64 to $BASE64_VERSION\"" |
| 43 | +echo "" |