Skip to content

Commit 04abeb3

Browse files
committed
Add --pre-release automatically for odd minor versions
1 parent 8099915 commit 04abeb3

4 files changed

Lines changed: 47 additions & 65 deletions

File tree

.devcontainer/ubuntu-24.04/.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
@arm-debug:registry=https://npm.pkg.github.com
1+
@open-cmsis-pack:registry=https://npm.pkg.github.com
22
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}

DEVELOPMENT.md

Lines changed: 22 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,20 @@ In short, run this command from the extracted directory on the Arm network:
3333
## Running the extension in development
3434

3535
1. To download the tools, you must have a `GITHUB_TOKEN` environment variable containing a
36-
personal access token. This must have the `repo` scope and SSO enabled for the Arm-Debug
37-
organization.
36+
personal access token.
3837

39-
2. In order to install dependencies, you must have npm configured to access the Arm-Debug registry
40-
for packages that are scoped with `@arm-debug`. Edit your global .npmrc file, and add the
38+
2. In order to install dependencies, Edit your global .npmrc file, and add the
4139
following to it:
4240

4341
```txt
44-
@arm-debug:registry=https://npm.pkg.github.com
42+
@open-cmsis-pack:registry=https://npm.pkg.github.com
4543
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
4644
```
4745
4846
This assumes a `GITHUB_TOKEN` environment variable is exported in your environment. This needs
4947
to be a GitHub personal access token with the `read:packages` scope set on it.
5048
51-
3. Install NPM dependencies, Core Tools and build the TypeScript
49+
3. Install NPM dependencies and build the TypeScript
5250
5351
```sh
5452
npm install
@@ -171,18 +169,6 @@ when running in development mode.
171169
Before running a release, check the following:
172170
173171
1. Tools and schemas integrated into the extension packages according to `package.json`
174-
- CoreTools version referenced by the dependency (see `dependencies` section)
175-
176-
`"@arm-debug/cmsis-core-tools-client": "<version>"`
177-
178-
`version` must match a [CoreTools release](https://github.com/Arm-Debug/cmsis-core-tools/tags)
179-
180-
- uv2csolution version referenced in `csolution` section
181-
182-
`"uv2csolutionVersion": "<version>"`
183-
184-
`<version>` must match a [uvprojx-converter release](https://github.com/Arm-Debug/uvprojx-converter/releases)
185-
186172
- schema version referenced in `csolution` section
187173
188174
`"schemaVersion": "<version>"`
@@ -198,59 +184,32 @@ Before running a release, check the following:
198184
199185
4. [Release Assessment](https://armh.sharepoint.com/sites/pwa/PJ1000480/SitePages/Assessments.aspx) for `CMSIS Solution Extension` is approved.
200186
201-
### Release workflow
187+
## Release versioning
202188
203-
Use GitHub Actions workflow dispatch to trigger a release:
189+
This repository follows the VS Code Marketplace pre-release recommendation:
204190
205-
1. Navigate to <https://github.com/Arm-Debug/vscode-cmsis-csolution/actions/workflows/ci.yml>,
206-
then click "Run workflow"
207-
2. Select the main branch
208-
3. Select type of new version, e.g. 'Minor'
209-
4. Select "Skip public publishing jobs' if the version should be created on GitHub but NOT being
210-
published to Marketplace
211-
5. Click "Run workflow"
191+
- **Odd** minor versions (`x.1.z`, `x.3.z`, ...) are pre-releases.
192+
- **Even** minor versions (`x.0.z`, `x.2.z`, ...) are full releases.
212193
213-
Notes
194+
To enforce this consistently, both packaging and publishing use `scripts/package.ts`, which:
214195
215-
- When 'Pre-release' is selected, the version is either:
216-
- incremented according the latest published pre-release (patch +1), if it is greater than the current version
217-
- incremented according the the current version, newMinorVersion is always an odd number (including 0), e.g. 0,1,3,...
218-
- When 'Major', 'Minor' or 'Patch' is selected, the version will be increased and the new version
219-
number will be committed to package.json. If a second release is triggered, it will also be
220-
increased, regardless of being pushed to marketplace or not.
221-
- 'Major' increments major version
222-
- 'Minor' increments to an even number, e.g. 0,2,4,...
223-
- 'Patch' increments patch version
224-
- see [vscode-actions](https://github.com/Arm-Debug/vscode-actions/blob/main/calculate-new-version/src/bump-version.ts)
196+
- checks the current `package.json` version minor value.
197+
- automatically adds `--pre-release` to `vsce package` for odd minor versions.
225198
226-
Github actions will then
199+
Use the following commands:
227200
228-
- Bump the versions in the package.json files
229-
- Add the new version to the CHANGELOG.md, and move all changes listed under "Unreleased" to the new version.
230-
- Commit and push the version and changelog updates
231-
- Build the VSIX package
232-
- Create a GitHub release with the VSIX package
233-
- Publish the package on [Open VSX](https://open-vsx.org/extension/arm/cmsis-csolution) and [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=Arm.cmsis-csolution)
234-
- Publish the API types to the Arm-Debug GitHub Packages npm registry
235-
- Sync the docs to [ARM-software/vscode-cmsis-csolution](https://github.com/ARM-software/vscode-cmsis-csolution)
236-
237-
After publishing, check that the new version is installable in VSCode and docs for the new version
238-
have been synced to Arm-Software.
239-
240-
### Publishing to VS Code Marketplace
241-
242-
The marketplace access token is controlled by the [DSG-OTG](https://dev.azure.com/DSG-OTG)
243-
organization in Azure. It is available in CI as an Arm-Debug GitHub organization secret. This must
244-
be rotated every 90 days.
245-
246-
See the documentation for publishing extensions:
247-
<https://code.visualstudio.com/api/working-with-extensions/publishing-extension>
201+
```sh
202+
> npm run package [--target <target>]
203+
```
248204
249-
### Publishing Open-VSX
205+
### Release Workflow
250206
251-
The arm namespace Open-VSX is accessible from your [user settings](https://open-vsx.org/user-settings)
252-
when your GitHub account has been linked to the arm namespace. An access token is stored as an
253-
Arm-Debug GitHub organization secret.
207+
1. Ensure the version in `package.json` is up to date.
208+
2. Update the `CHANGELOG` with the latest changes.
209+
3. Open a pull request with these updates and merge it into `main`.
210+
4. Create a new release at: https://github.com/Open-CMSIS-Pack/vscode-cmsis-solution/releases
211+
- This will trigger the `CI.yml` workflow.
212+
- Once the workflow completes successfully, the release artifacts will be generated automatically.
254213
255214
## Debugging in KSC
256215

scripts/package.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,20 @@ import * as path from 'path';
2222
import { glob } from 'glob';
2323
import { fileURLToPath } from 'url';
2424
import { execSync } from 'child_process';
25+
import { parse as parseSemver } from 'semver';
2526

2627
const argv = process.argv.slice(2);
2728

29+
function isOddMinorVersion(version: string): boolean {
30+
const parsedVersion = parseSemver(version);
31+
32+
if (!parsedVersion) {
33+
throw new Error(`Invalid package version: ${version}`);
34+
}
35+
36+
return parsedVersion.minor % 2 === 1;
37+
}
38+
2839
// default target: host OS and architecture
2940
let target = `${os.platform()}-${os.arch()}`;
3041

@@ -38,6 +49,18 @@ if (targetFlag !== -1) {
3849
// copy pre-downloaded node-pty for the target platform
3950
const __filename = fileURLToPath(import.meta.url);
4051
const __dirname = path.dirname(__filename);
52+
const packageJsonPath = path.resolve(__dirname, '..', 'package.json');
53+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) as { version?: string };
54+
const version = packageJson.version;
55+
56+
if (!version) {
57+
throw new Error(`Missing version in ${packageJsonPath}`);
58+
}
59+
60+
if (isOddMinorVersion(version) && !argv.includes('--pre-release')) {
61+
argv.push('--pre-release');
62+
}
63+
4164
const src = path.resolve(__dirname, '..','tools', 'node-pty');
4265
if (fs.existsSync(src)) {
4366
const dst = path.resolve(__dirname, '..', 'node_modules', '@lydell');

src/data-manager/DESIGN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
## Introduction
66

7-
The Data Manager is responsible for fetching data from various sources, such as [Core Tools](https://github.com/Arm-Debug/cmsis-core-tools) or [Solar Search](https://solar-search.api.keil.arm.com/). The interface is agnostic to the actual source, i.e., the user shall not need to know about the source in order to use the retrieved information.
7+
The Data Manager is responsible for fetching data from various sources, such as [Solar Search](https://solar-search.api.keil.arm.com/). The interface is agnostic to the actual source, i.e., the user shall not need to know about the source in order to use the retrieved information.
88

99
## Design
1010

0 commit comments

Comments
 (0)