Skip to content

Commit 9e7adc7

Browse files
authored
Nightly javascript (#13844)
* [js] Adding node setup to main bazel.yml * [js] Nightly for JavaScript * [js] Adding missing parameter * [js] Building and packaging locally, npm to publish * [js] Trying to push with wildcard * [js] Trying to set the NODE_AUTH_TOKEN * [js] Debugging * [js] Modifying npmrc * [js] Copying npmrc * [js] Now trying with publishConfig and registru * [js] Fixing command for ubuntu * [js] Trying more things to auth * [js] Both npmrc files * [js] Changing package name * [js] Bumping version * [js] Removing next tag * [js] Just publishing once * [js] Only npmrc on the root directory * [js] Only npmrc on the root directory * [js] Using nightly now
1 parent f36b334 commit 9e7adc7

File tree

6 files changed

+67
-7
lines changed

6 files changed

+67
-7
lines changed

.github/workflows/bazel.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ on:
4646
required: false
4747
type: string
4848
default: ''
49+
node-version:
50+
description: Custom Node version to install
51+
required: false
52+
type: string
53+
default: ''
4954
ruby-version:
5055
description: Custom Ruby version to use
5156
required: false
@@ -72,6 +77,7 @@ jobs:
7277
SEL_M2_PASS: ${{ secrets.SEL_M2_PASS }}
7378
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
7479
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
80+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7581
SE_AVOID_STATS: true
7682
steps:
7783
- name: Checkout source tree
@@ -103,6 +109,11 @@ jobs:
103109
with:
104110
java-version: ${{ inputs.java-version }}
105111
distribution: 'temurin'
112+
- name: Setup Node
113+
if: inputs.node-version != ''
114+
uses: actions/setup-node@v4
115+
with:
116+
node-version: ${{ inputs.node-version }}
106117
- name: Setup Bazel with caching
107118
if: inputs.caching
108119
uses: bazel-contrib/[email protected]

.github/workflows/nightly.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
- python
2121
- grid
2222
- dotnet
23+
- javascript
2324

2425
jobs:
2526
ruby:
@@ -89,3 +90,21 @@ jobs:
8990
echo build --stamp >>.bazelrc.local
9091
./go java-release-zip
9192
nightly-release-files: build/dist/*.*
93+
94+
javascript:
95+
if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'javascript' || github.event_name == 'schedule')
96+
name: DotNet
97+
uses: ./.github/workflows/bazel.yml
98+
with:
99+
name: Nightly JavaScript Release
100+
cache-key: javascript-nightly
101+
node-version: '18.x'
102+
run: |
103+
sed -i 's|https://registry.npmjs.org/|https://npm.pkg.github.com|g' javascript/node/selenium-webdriver/package.json
104+
sed -i 's|"name": "selenium-webdriver"|"name": "@seleniumhq/selenium-webdriver"|g' javascript/node/selenium-webdriver/package.json
105+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
106+
echo "@seleniumhq:registry=https://npm.pkg.github.com" >> .npmrc
107+
echo "always-auth=true" >> .npmrc
108+
./go "node:version[nightly]"
109+
./go node:release
110+
secrets: inherit

Rakefile

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ namespace :node do
496496
end
497497

498498
task :'dry-run' do
499-
Bazel.execute('run', ['--stamp'], '//javascript/node/selenium-webdriver:selenium-webdriver.pack')
499+
Bazel.execute('run', ['--stamp'], '//javascript/node/selenium-webdriver:selenium-webdriver.publish -- --dry-run=true')
500500
end
501501

502502
desc 'Release Node npm package'
@@ -520,16 +520,43 @@ namespace :node do
520520

521521
desc 'Update Node version'
522522
task :version, [:version] do |_task, arguments|
523+
bump_nightly = arguments[:version] === 'nightly'
523524
old_version = node_version
524-
new_version = updated_version(old_version, arguments[:version])
525+
new_version = nil
526+
527+
# There are three cases we want to deal with:
528+
# 1. Switching from a release build to a nightly one
529+
# 2. Updating a nightly build for the next nightly build
530+
# 3. Switching from nightlies to a release build.
531+
532+
if bump_nightly && old_version.include?('-nightly')
533+
# This is the case where we are updating a nightly build to the next nightly build.
534+
# This change is usually done by the CI system and never committed.
535+
# The "-nightlyYmdHM" is removed to add a new timestamp.
536+
new_version = old_version.gsub(/\-nightly\d+$/, '') + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
537+
elsif bump_nightly
538+
# This is the case after a production release and the version number is configured
539+
# to start doing nightly builds.
540+
new_version = old_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
541+
else
542+
if old_version.include?('-nightly')
543+
# From a nightly build to a release build.
544+
new_version = old_version.gsub(/\-nightly\d+$/, '')
545+
else
546+
# From a release build to a nightly build. We use npm version for this.
547+
new_version = updated_version(old_version.gsub(/\-nightly\d+$/, ''), arguments[:version])
548+
new_version = new_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
549+
end
550+
end
525551

526552
['javascript/node/selenium-webdriver/package.json',
527-
'package-lock.json'].each do |file|
553+
'package-lock.json',
554+
'javascript/node/selenium-webdriver/BUILD.bazel'].each do |file|
528555
text = File.read(file).gsub(old_version, new_version)
529556
File.open(file, "w") { |f| f.puts text }
530557
end
531558

532-
Rake::Task['node:changelog'].invoke
559+
Rake::Task['node:changelog'].invoke unless new_version.include?('-nightly') || bump_nightly
533560
end
534561
end
535562

javascript/node/selenium-webdriver/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ load("//javascript:defs.bzl", "mocha_test")
99

1010
npm_link_all_packages(name = "node_modules")
1111

12-
VERSION = "4.16.0"
12+
VERSION = "4.20.0-nightly202404191827"
1313

1414
BROWSER_VERSIONS = [
1515
"v85",

javascript/node/selenium-webdriver/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selenium-webdriver",
3-
"version": "4.19.0",
3+
"version": "4.20.0-nightly202404191827",
44
"description": "The official WebDriver JavaScript bindings from the Selenium project",
55
"license": "Apache-2.0",
66
"keywords": [
@@ -54,5 +54,8 @@
5454
"mocha": {
5555
"recursive": true,
5656
"timeout": 600000
57+
},
58+
"publishConfig": {
59+
"registry": "https://registry.npmjs.org/"
5760
}
5861
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)