Skip to content

Commit

Permalink
Nightly javascript (#13844)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
diemol authored Apr 19, 2024
1 parent f36b334 commit 9e7adc7
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ on:
required: false
type: string
default: ''
node-version:
description: Custom Node version to install
required: false
type: string
default: ''
ruby-version:
description: Custom Ruby version to use
required: false
Expand All @@ -72,6 +77,7 @@ jobs:
SEL_M2_PASS: ${{ secrets.SEL_M2_PASS }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SE_AVOID_STATS: true
steps:
- name: Checkout source tree
Expand Down Expand Up @@ -103,6 +109,11 @@ jobs:
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
- name: Setup Node
if: inputs.node-version != ''
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- name: Setup Bazel with caching
if: inputs.caching
uses: bazel-contrib/[email protected]
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
- python
- grid
- dotnet
- javascript

jobs:
ruby:
Expand Down Expand Up @@ -89,3 +90,21 @@ jobs:
echo build --stamp >>.bazelrc.local
./go java-release-zip
nightly-release-files: build/dist/*.*

javascript:
if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'javascript' || github.event_name == 'schedule')
name: DotNet
uses: ./.github/workflows/bazel.yml
with:
name: Nightly JavaScript Release
cache-key: javascript-nightly
node-version: '18.x'
run: |
sed -i 's|https://registry.npmjs.org/|https://npm.pkg.github.com|g' javascript/node/selenium-webdriver/package.json
sed -i 's|"name": "selenium-webdriver"|"name": "@seleniumhq/selenium-webdriver"|g' javascript/node/selenium-webdriver/package.json
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
echo "@seleniumhq:registry=https://npm.pkg.github.com" >> .npmrc
echo "always-auth=true" >> .npmrc
./go "node:version[nightly]"
./go node:release
secrets: inherit
35 changes: 31 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ namespace :node do
end

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

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

desc 'Update Node version'
task :version, [:version] do |_task, arguments|
bump_nightly = arguments[:version] === 'nightly'
old_version = node_version
new_version = updated_version(old_version, arguments[:version])
new_version = nil

# There are three cases we want to deal with:
# 1. Switching from a release build to a nightly one
# 2. Updating a nightly build for the next nightly build
# 3. Switching from nightlies to a release build.

if bump_nightly && old_version.include?('-nightly')
# This is the case where we are updating a nightly build to the next nightly build.
# This change is usually done by the CI system and never committed.
# The "-nightlyYmdHM" is removed to add a new timestamp.
new_version = old_version.gsub(/\-nightly\d+$/, '') + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
elsif bump_nightly
# This is the case after a production release and the version number is configured
# to start doing nightly builds.
new_version = old_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
else
if old_version.include?('-nightly')
# From a nightly build to a release build.
new_version = old_version.gsub(/\-nightly\d+$/, '')
else
# From a release build to a nightly build. We use npm version for this.
new_version = updated_version(old_version.gsub(/\-nightly\d+$/, ''), arguments[:version])
new_version = new_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
end
end

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

Rake::Task['node:changelog'].invoke
Rake::Task['node:changelog'].invoke unless new_version.include?('-nightly') || bump_nightly
end
end

Expand Down
2 changes: 1 addition & 1 deletion javascript/node/selenium-webdriver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ load("//javascript:defs.bzl", "mocha_test")

npm_link_all_packages(name = "node_modules")

VERSION = "4.16.0"
VERSION = "4.20.0-nightly202404191827"

BROWSER_VERSIONS = [
"v85",
Expand Down
5 changes: 4 additions & 1 deletion javascript/node/selenium-webdriver/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "selenium-webdriver",
"version": "4.19.0",
"version": "4.20.0-nightly202404191827",
"description": "The official WebDriver JavaScript bindings from the Selenium project",
"license": "Apache-2.0",
"keywords": [
Expand Down Expand Up @@ -54,5 +54,8 @@
"mocha": {
"recursive": true,
"timeout": 600000
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9e7adc7

Please sign in to comment.