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

New release script for individual binary installs #1125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Update binaries
run: |
$ErrorActionPreference = 'SilentlyContinue'
git clone --recursive https://github.com/uNetworking/uWebSockets.js.git
git clone --recursive https://github.com/${{ github.repository }}.git
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was easier for when testing on my fork, but let me know if I should revert this and the others

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works this is better

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be just fine 👍

cd uWebSockets.js
nmake
git fetch origin binaries:binaries
Expand All @@ -23,7 +23,7 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "Alex Hultman"
git commit -a -m "[GitHub Actions] Updated windows-latest binaries"
git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries
git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/${{ github.repository }}" binaries
git checkout master -- tests/smoke.js
npm install ws
node tests/smoke.js
Expand All @@ -39,7 +39,7 @@ jobs:
sudo apt update || true
brew install go || true
sudo apt install -y g++-aarch64-linux-gnu || true
git clone --recursive https://github.com/uNetworking/uWebSockets.js.git
git clone --recursive https://github.com/${{ github.repository }}.git
cd uWebSockets.js
make
git fetch origin binaries:binaries
Expand All @@ -52,7 +52,7 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "Alex Hultman"
git commit -a -m "[GitHub Actions] Updated ${{ matrix.os }} binaries" || true
git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries
git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/${{ github.repository }}" binaries
git checkout master -- tests/smoke.js
npm install ws
node tests/smoke.js
Expand All @@ -66,7 +66,7 @@ jobs:
os: ubuntu20.04
steps:
- name: Clone
run: git clone --recursive https://github.com/uNetworking/uWebSockets.js.git
run: git clone --recursive https://github.com/${{ github.repository }}.git
- uses: uraimo/[email protected]
name: Compile binaries
with:
Expand Down Expand Up @@ -94,4 +94,4 @@ jobs:
git config --global user.name "Alex Hultman"
git add *.node *.js
git commit -a -m "[GitHub Actions] Updated linux-${{ matrix.arch }} binaries" || true
git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries
git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/${{ github.repository }}" binaries
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Version number for the new release'
required: true

jobs:
release:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Release new version
run: |
git config --global user.email "[email protected]"
git config --global user.name "Alex Hultman"
git clone --branch binaries --single-branch --depth 1 https://github.com/${{ github.repository }}.git
cd uWebSockets.js

version="${{ github.event.inputs.version }}"
binaries=($(find . -type f -name "*.node" -exec basename {} .node \;))

declare -A abi_map=(
["108"]="18.x"
["115"]="20.x"
["120"]="21.x"
["127"]="22.x"
["131"]="23.x"
)

for binary in "${binaries[@]}"; do
IFS='_' read -r os cpu abi <<< "${binary#uws_}"
node_version="${abi_map[$abi]}"

echo '{
"name": "@uws/'"$binary"'",
"version": "'"${version}"'",
"main": "uws.js",
"os": ["'"$os"'"],
"cpu": ["'"$cpu"'"],
"engines": {
"node": "'"$node_version"'"
}
}' > package.json

echo 'module.exports = require("./'"$binary"'.node")' > uws.js

rm ESM_wrapper.mjs index.d.ts
find . -name '*.node' ! -name "${binary}.node" -exec rm -f {} +

git checkout --detach
git add -A
git commit -m "Released @uws/$binary with version $version"
git tag "v${version}-$binary"
git push "https://x-access-token:${{ secrets.SECRET }}@github.com/${{ github.repository }}" "v${version}-$binary"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might need to change the username from x-access-token here back to unetworkingab - let me know if I should do that, or we can see if it's fine when you do a test release

git checkout binaries
done

rm -rf *.node

deps=""
for binary in "${binaries[@]}"; do
deps+="\"@uws/$binary\": \"github:porsager/uWebSockets.js#v${version}-$binary\",\n "
done
deps=${deps%,*}

sed -i "s|\"optionalDependencies\": {}|\"optionalDependencies\": {\n $deps\n}|" package.json
sed -i "s|\"version\": \"[^\"]*\"|\"version\": \"${version}\"|g" package.json
sed -i "s|./uws_|@uws/uws_|g" uws.js

git checkout --detach
git add package.json
git add *.node
git commit -m "Release $version"

git tag "v$version"
git push "https://x-access-token:${{ secrets.SECRET }}@github.com/${{ github.repository }}" "v$version"
2 changes: 1 addition & 1 deletion src/uws.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module.exports = (() => {
try {
return require('./uws_' + process.platform + '_' + process.arch + '_' + process.versions.modules + '.node');
return require('./uws_' + process.platform + '_' + process.arch + '_' + process.versions.modules);
} catch (e) {
throw new Error('This version of uWS.js (v20.51.0) supports only Node.js versions 18, 20, 22 and 23 on (glibc) Linux, macOS and Windows, on Tier 1 platforms (https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list).\n\n' + e.toString());
}
Expand Down