Skip to content

Commit 92d2e71

Browse files
Update versioning scheme to use fixed version instead of independent version
1 parent 00761a7 commit 92d2e71

File tree

4 files changed

+37
-41
lines changed

4 files changed

+37
-41
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build ruby.wasm
22
on:
33
push:
44
branches: [main]
5-
tags: ["*/*"]
5+
tags: ["*"]
66
paths-ignore:
77
- "*.md"
88
- "docs/**"

CONTRIBUTING.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,8 @@ If you see `missing executable: cargo`, please make sure `cargo` is installed co
103103
To bump up npm package version, please follow the below steps:
104104

105105
```
106-
$ rake 'npm:bump_version[ruby-head-wasm-wasi, 0.6.0]'
107-
$ git commit -m"Bump ruby-head-wasm-wasi version to 0.6.0"
108-
$ git tag ruby-head-wasm-wasi/0.6.0
109-
$ git push origin ruby-head-wasm-wasi/0.6.0
106+
$ rake 'bump_version[0.6.0]'
107+
$ git commit -m"Bump version to 0.6.0"
108+
$ git tag 0.6.0
109+
$ git push origin 0.6.0
110110
```
111-
112-
## Versioning Scheme
113-
114-
This repository contains multiple packages to be released independently. Each package has its own semantic version number.
115-
116-
The git tag name is composed of the package name and the version number, separated by `/`. For example, `ruby-head-wasm-wasi/0.6.0` is the git tag name for the `ruby-head-wasm-wasi` package version `0.6.0`.
117-
118-
Also this repository releases all packages every day as nightly builds. The version format of nightly builds is not guaranteed to be stable, but it is usually composed of the date and monotonically increasing alphabetical characters. For example, `2023-01-28-a` is a git tag name for a nightly build of `2023/01/28`. Each package has its own nightly versioning scheme.

tasks/packaging.rake

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,6 @@ namespace :npm do
3838
end
3939
end
4040

41-
desc "Bump version"
42-
task :bump_version, %i[package version] do |t, args|
43-
require "json"
44-
package = args[:package] or raise "package name is required"
45-
version = args[:version] or raise "version is required"
46-
pkg_dir = "#{Dir.pwd}/packages/npm-packages/#{package}"
47-
pkg_json = "#{pkg_dir}/package.json"
48-
package = JSON.parse(File.read(pkg_json))
49-
old_version = package["version"]
50-
pkg_name = package["name"]
51-
package["version"] = version
52-
File.write(pkg_json, JSON.pretty_generate(package) + "\n")
53-
54-
# Update package-lock.json
55-
Dir.chdir(pkg_dir) { sh "npm install" }
56-
# Update README.md and other docs
57-
`git grep -l #{pkg_name}@#{old_version}`.split.each do |file|
58-
content = File.read(file)
59-
next_nightly = Date.today.strftime("%Y-%m-%d")
60-
content.gsub!(
61-
/#{pkg_name}@#{old_version}-\d{4}-\d{2}-\d{2}-a/,
62-
"#{pkg_name}@#{version}-#{next_nightly}-a"
63-
)
64-
content.gsub!(/#{pkg_name}@#{old_version}/, "#{pkg_name}@#{version}")
65-
File.write(file, content)
66-
end
67-
end
68-
6941
desc "Build all npm packages"
7042
multitask all: NPM_PACKAGES.map { |pkg| pkg[:name] }
7143
end

tasks/version.rake

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
def bump_version_npm_package(package, version)
2+
require "json"
3+
pkg_dir = "#{Dir.pwd}/packages/npm-packages/#{package}"
4+
pkg_json = "#{pkg_dir}/package.json"
5+
package = JSON.parse(File.read(pkg_json))
6+
old_version = package["version"]
7+
pkg_name = package["name"]
8+
package["version"] = version
9+
File.write(pkg_json, JSON.pretty_generate(package) + "\n")
10+
11+
# Update package-lock.json
12+
Dir.chdir(pkg_dir) { sh "npm install" }
13+
# Update README.md and other docs
14+
`git grep -l #{pkg_name}@#{old_version}`.split.each do |file|
15+
content = File.read(file)
16+
next_nightly = Date.today.strftime("%Y-%m-%d")
17+
content.gsub!(
18+
/#{pkg_name}@#{old_version}-\d{4}-\d{2}-\d{2}-a/,
19+
"#{pkg_name}@#{version}-#{next_nightly}-a"
20+
)
21+
content.gsub!(/#{pkg_name}@#{old_version}/, "#{pkg_name}@#{version}")
22+
File.write(file, content)
23+
end
24+
end
25+
26+
27+
task :bump_version, %i[version] do |t, args|
28+
version = args[:version] or raise "version is required"
29+
NPM_PACKAGES.each do |pkg|
30+
bump_version_npm_package(pkg[:name], version)
31+
end
32+
end

0 commit comments

Comments
 (0)