ci: change condition
MODIFY
.github/workflows/release.yml
.github/workflows/release.yml
@@ -41,7 +41,9 @@ jobs:
id: prerelease
if: env.nightly == 'true' || steps.version.outputs.type == 'prerelease' || steps.version.outputs.type == 'prepatch' || steps.version.outputs.type == 'premajor' || steps.version.outputs.type == 'preminor'
working-directory: editors/vscode
- run: echo "prerelease=true" >> $GITHUB_ENV
+ run: |
+ echo "prerelease=true" >> $GITHUB_ENV
+ echo "version=$(node ./scripts/updateVersionForPrerelease.js)" >> $GITHUB_ENV
- name: Check version status
if: steps.version.outputs.changed == 'true'
@@ -120,15 +122,10 @@ jobs:
with:
node-version: 14.x
- - name: Check prerelease status
- id: prerelease
- if: env.nightly == 'true' || steps.version.outputs.type == 'prerelease' || steps.version.outputs.type == 'prepatch' || steps.version.outputs.type == 'premajor' || steps.version.outputs.type == 'preminor'
+ - name: Update package.json version
+ if: needs.check.outputs.prerelease == 'true'
working-directory: editors/vscode
- run: |
- CURRENT_VERSION=$(cat package.json | grep version | awk '{print $2}' | sed 's/"//g' | sed 's/,//g')
- NEW_VERSION=${{ steps.version.outputs.version }}-$(date +"pre-release-%F-%s")}
- cat package.json | sed "s/'"version": "${CURRENT_VERSION}"'/'"version": "${NEW_VERSION}"'/g" > temp
- mv temp package.json
+ run: node ./scripts/updateVersionForPrerelease.js
- name: Package extension
run: |
@@ -170,15 +167,15 @@ jobs:
with:
name: vscode_packages
- - name: Check prerelease status
- id: prerelease
- if: env.nightly == 'true' || steps.version.outputs.type == 'prerelease' || steps.version.outputs.type == 'prepatch' || steps.version.outputs.type == 'premajor' || steps.version.outputs.type == 'preminor'
+ - name: Install Node.js
+ uses: actions/setup-node@v1
+ with:
+ node-version: 14.x
+
+ - name: Update package.json version
+ if: needs.check.outputs.prerelease == 'true'
working-directory: editors/vscode
- run: |
- CURRENT_VERSION=$(cat package.json | grep version | awk '{print $2}' | sed 's/"//g' | sed 's/,//g')
- NEW_VERSION=${{ steps.version.outputs.version }}-$(date +"pre-release-%F-%s")}
- cat package.json | sed "s/'"version": "${CURRENT_VERSION}"'/'"version": "${NEW_VERSION}"'/g" > temp
- mv temp package.json
+ run: node ./scripts/updateVersionForPrerelease.js
- name: Publish extension (pre-release)

MODIFY
CONTRIBUTING.md
CONTRIBUTING.md
@@ -275,3 +275,10 @@ Use the `"rome.lspBin"` VS Code setting to set the path to the executable:
```
When performing any benchmarks for the language server, be sure to use a release build.
+
+### Versioning
+
+We follow the specs suggested by [the official documentation](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions):
+
+Odd minor versions are dedicated to pre-releases, e.g. `*.5.*` .
+Even minor versions are dedicated to official releases, e.g. `*.6.*`.
\ No newline at end of file

MODIFY
editors/vscode/package.json
editors/vscode/package.json
"description": "Rome LSP VS Code Extension",
"version": "0.0.4",
"icon": "icon.png",
+ "type": "module",
"activationEvents": [
"onLanguage:javascript",
"onLanguage:typescript"

ADD
editors/vscode/scripts/updateVersionForPrerelease.js
+import {readFile, writeFile} from "node:fs/promises";
+import {join, resolve} from "node:path";
+
+const manifestPath = resolve(join("package.json"));
+
+function pad(date) {
+ if (date < 10) {
+ return "0" + date;
+ }
+ return "" + date
+}
+
+// read the package.json file
+readFile(manifestPath, "utf8").then(async (value) => {
+ const manifest = JSON.parse(value);
+ const currentVersion = manifest.version;
+ const versionAsSemver = currentVersion.split(".");
+ // first one is the major
+ const currentMajor = parseInt(versionAsSemver[0]);
+ // second one is the minor
+ const currentMinor = parseInt(versionAsSemver[1]);
+
+ const date = new Date();
+ const newMinor = currentMinor + 1;
+ const newPatch = [pad(date.getFullYear()), pad(date.getMonth() + 1), pad(date.getDate())].join("");
+ // update the version field
+ manifest.version = `${currentMajor}.${newMinor}.${newPatch}`;
+ try {
+ await writeFile(manifestPath, JSON.stringify(manifest, null, "\t"));
+ console.log(manifest.version)
+ } catch (_e) {
+ console.log("Could not write the package.json file at " + manifestPath)
+ process.exit(1);
+
+ }
+}).catch(() => {
+ console.log("Could not read the package.json file at " + manifestPath)
+ process.exit(1);
+})
+
+

ci: change condition (#2225)