Skip to content

Commit

Permalink
Update dependencies in package.json: restore glide-rs and upgrade typ…
Browse files Browse the repository at this point in the history
…escript and uuid versions

Signed-off-by: avifenesh <[email protected]>
  • Loading branch information
avifenesh committed Nov 21, 2024
1 parent 9bf0bcf commit a05aa9e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/json_matrices/build-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"ARCH": "arm64",
"TARGET": "aarch64-unknown-linux-musl",
"RUNNER": ["self-hosted", "Linux", "ARM64"],
"IMAGE": "node:lts-alpine3.19",
"IMAGE": "node:lts-alpine",
"CONTAINER_OPTIONS": "--user root --privileged --rm",
"PACKAGE_MANAGERS": ["npm"],
"languages": ["node"]
Expand All @@ -44,7 +44,7 @@
"ARCH": "x64",
"TARGET": "x86_64-unknown-linux-musl",
"RUNNER": "ubuntu-latest",
"IMAGE": "node:lts-alpine3.19",
"IMAGE": "node:lts-alpine",
"CONTAINER_OPTIONS": "--user root --privileged",
"PACKAGE_MANAGERS": ["npm"],
"languages": ["node"]
Expand Down
52 changes: 40 additions & 12 deletions .github/workflows/npm-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,21 @@ jobs:
working-directory: ./node
run: |
npm pkg fix
set +e
# 2>&1 1>&3- redirects stderr to stdout and then redirects the original stdout to another file descriptor,
# effectively separating stderr and stdout. The 3>&1 at the end redirects the original stdout back to the console.
# https://github.com/npm/npm/issues/118#issuecomment-325440 - ignoring notice messages since currentlly they are directed to stderr
{ npm_publish_err=$(npm publish --tag ${{ env.NPM_TAG }} --access public 2>&1 1>&3- | grep -Ev "notice|ExperimentalWarning") ;} 3>&1
if [[ "$npm_publish_err" == *"You cannot publish over the previously published versions"* ]]
then
echo "Skipping publishing, package already published"
elif [[ ! -z "$npm_publish_err" ]]
then
echo "Failed to publish with error: ${npm_publish_err}"
# Attempt to publish and capture output and exit code
npm_publish_output=$(npm publish --tag "${NPM_TAG}" --access public 2>&1)
publish_exit_code=$?
if [[ $publish_exit_code -eq 0 ]]; then
echo "Package published successfully."
elif echo "$npm_publish_output" | grep -q "You cannot publish over the previously published versions"; then
echo "Skipping publishing, package already published."
else
echo "Failed to publish with error: $npm_publish_output"
exit 1
fi
echo "npm publish output: $npm_publish_output"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

Expand Down Expand Up @@ -374,11 +376,37 @@ jobs:
npm install
npm install --no-save @valkey/valkey-glide@${{ env.NPM_TAG }}
npm run test
# fail on purpose to test the unpublish action
exit 1
- name: Unpublish packages on failure
if: ${{ always() }} && ${{ failure() }}
shell: bash
run: |
echo "Tests failed, unpublishing packages..."
# Unpublish the base package
npm unpublish @$valkey/valkey-glide@${{ inputs.version }} --force || true
# Save PLATFORM_MATRIX to a file
echo '${{ needs.load-platform-matrix.outputs.PLATFORM_MATRIX }}' > platform_matrix.json
# Extract package names from platform matrix
jq -r '.[] | "\(.NAMED_OS)\(.TARGET | test("musl") | if . then "-musl" else "" end)-\(.ARCH)"' platform_matrix.json > package_names.txt
# Loop over each package name and unpublish
while read -r pkg; do
package_name="@valkey/valkey-glide-${pkg}"
echo "Unpublishing $package_name@${{ inputs.version }}"
npm unpublish ${package_name}@${{ inputs.version }} --force || true
done < package_names.txt
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

# Reset the repository to make sure we get the clean checkout of the action later in other actions.
# It is not required since in other actions we are cleaning before the action, but it is a good practice to do it here as well.
- name: Reset repository
if: ${{ contains(matrix.build.RUNNER, 'self-hosted') }}
if: ${{ always() }} && ${{ contains(matrix.build.RUNNER, 'self-hosted') }}
shell: bash
run: |
git reset --hard
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
- name: Setup self-hosted runner access
if: ${{ matrix.build.TARGET == 'aarch64-unknown-linux-gnu' }}
run: sudo chown -R $USER:$USER /home/ubuntu/actions-runner/_work/valkey-glide

- name: checkout
uses: actions/checkout@v4

Expand Down
4 changes: 2 additions & 2 deletions node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"semver": "^7.6.3",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.5.4",
"uuid": "^11.0"
"typescript": "^5.6.3",
"uuid": "^11.0.3"
},
"author": "Valkey GLIDE Maintainers",
"license": "Apache-2.0",
Expand Down

0 comments on commit a05aa9e

Please sign in to comment.