Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor GitHub Actions workflows #135

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: ovsx-solid---publish-vscode-built-in-extensions-specific-version
name: Build and Publish VS Code Extensions
on:
workflow_dispatch:
push:
branches:
- ovsx-publish
- master
pull_request:
branches:
- master
env:
NODE_OPTIONS: --max-old-space-size=8192
jobs:
Expand All @@ -20,7 +24,7 @@ jobs:
# should be aligned with https://github.com/microsoft/vscode/blob/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/.github/workflows/ci.yml#L108
- run: |
sudo apt-get update
sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0
sudo apt-get install -y libxkbfile-dev pkg-config libkrb5-dev libxss1 dbus xvfb libgtk-3-0 libgbm1
sudo cp vscode/build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
sudo chmod +x /etc/init.d/xvfb
sudo update-rc.d xvfb defaults
Expand All @@ -29,15 +33,17 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: vscode/.nvmrc
- run: npx ovsx --version
name: Check ovsx version
- run: |
- name: Check ovsx version
run: npx ovsx --version
- name: Bundle Extensions
run: |
yarn
yarn build:extensions
name: Bundle Extensions
- run: yarn package-vsix:latest
name: Package Solid Version of Extensions
- run: yarn create-extension-pack:latest
name: Create built-in extensions pack
- run: yarn publish:vsix
- name: Package Solid Version of Extensions
run: yarn package-vsix
- name: Create built-in extensions pack
run: yarn create-extension-pack
# Only publish the extensions if the workflow was manually triggered
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Publish Extensions to open-vsx.org
run: yarn publish:vsix
49 changes: 0 additions & 49 deletions .github/workflows/publish-vsx-latest.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/publish-vsx-next.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/publish-vsx-specific-next.yml

This file was deleted.

27 changes: 10 additions & 17 deletions doc/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,21 @@ Remove part saying `mode: production` and redo the build

Once we have built our extensions, we can packge them into `*.vsix`-files using this package script:

yarn package-vsix:latest
yarn package-vsix

The script will produce `*.vsix` files in a folder called `./dist`. The vsix files will be named like `<name>-<vscode-version>.vsix`. Note that the publisher (msvscode)
is not included.

If you want to create a prerelease version, you can do so by invoking

yarn package-vsix:next

This will generate `*.vsix` files of the form `<name>-<vscode-version>-next.<commit hash>.vsix`

**Implementation Note:** the VS Code build process puts some shared dependencies in a `node_modules` folder which is located in the "extensions" folder at run time. In order to produce self-contained extensions, we need to include those modules (at the time, it's the typescript language server) into the packaged extensions (currently for `typescript-language-features` and `html-language-features`). The code doing this is located in `src/package-vsix.js`. We also need to patch the `typescript-language-features` extension because it contains a hard-code reference to `../node_modules`.
> [!NOTE]
> The VS Code build process puts some shared dependencies in a `node_modules` folder which is located in the "extensions" folder at run time.
> In order to produce self-contained extensions, we need to include those modules (at the time, it's the typescript language server) into the packaged extensions (currently for `typescript-language-features` and `html-language-features`).
> The code doing this is located in `src/package-vsix.js`. We also need to patch the `typescript-language-features` extension because it contains a hard-code reference to `../node_modules`.

### Creating the built-ins extension-pack

We also create an extension pack from the internal and external built-ins into the `dist` folder with a package script. The file name will be of the form:
builtin-extension-pack-<vscode version>.vsix.

yarn create-extension-pack:latest

Again, we can produce a preview release of the form `builtin-extension-pack-<vscode version>-next-.vsix

yarn create-extension-pack:next
We also create an extension pack from the internal and external built-ins into the `dist` folder with a package script.
The file name will be of the form: `builtin-extension-pack-<vscode version>.vsix`.

Note that you will have to package the `next` versions of the built-in extensions before they can be included in a `next` extensions pack.
```sh
yarn create-extension-pack
```
40 changes: 6 additions & 34 deletions doc/Publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,41 +121,13 @@ check out the correct version of VS Code upon `git submodule update`. The conven

## Publishing to openvsx.org

**Before publishing to open-vsx, all issues opened in [internal](#ip-checks-for-vs-code-built-ins) and [external](#ip-checks-for-external-vs-code-built-ins) should be closed.**
Please work with the Eclipse Foundation staff and the Theia community if there are problems!
> [!IMPORTANT]
> **Before publishing to open-vsx, all issues opened in [internal](#ip-checks-for-vs-code-built-ins) and [external](#ip-checks-for-external-vs-code-built-ins) should be closed.**
> Please work with the Eclipse Foundation staff and the Theia community if there are problems!

Publishing is done using GitHub Actions. In the vscode-builtin-extensions repo, a publish token for open-vsx.org has been set, that can be used to publish under the identity of the openvsx publish bot.

There are four workflows in this repo.
Building and optionally publishing the extensions is done through the `Build and Publish VS Code Extensions` workflow.
On any pull request and push to the `master` branch, the workflow will build and package all VS Code extensions to ensure that the build scripts still work as expected.

- **publish-vsx-latest.yml:** Will check out the latest tagged version of VS Code and builds and packages a release version of the extensions and extension pack
- **publish-vsix-next.yml:** Will check out the VS Code `main branch` and build a prerelase version.

both these workflows are triggered on a regular schedule and upon push to the master branch

- **publish-vsx-specific-latest:** This action is triggered upon pushes to the branch `ovsx-publish`. It checks out the version of VS Code that is checked in as a submodule
on the branch and creates and packages a release version of the built-ins. It then publishes the built-ins and extension pack to the open-vsx registry.
- **publish-vsx-specific-next:** This action is triggered upon pushes to the branch `ovsx-publish-next`. It checks out the version of VS Code that is checked in as a submodule
on the branch and creates and packages a prerelease version of the built-ins. It then publishes the built-ins and extension pack to the open-vsx registry.

For "regular" vs. "prerelease" vesions see [Building.md](./Building.md))

In order to publish updated built-ins, we replace the contents of the `osvx-publish` branch. First, we make sure we're on the branch we're created in the "Testing" section:

git checkout 1.72.2
git branch -D ovsx-publish # delete the local version of the publsh branch
git checkout -b osvx-publish # copy our current branch to `osvx-publish`
git push origin # if the push fails because the branch can't be fast-forwarded, add the `-f` flag

Go in the [Actions](https://github.com/eclipse-theia/vscode-builtin-extensions/actions) tab to observe the publishing progress.

The publish workflow may fail, usually because the prerequisites for building the built-ins have changed. In this case, make the necessary change in the relevant workflows. In general, the setup should be aligned with the CI setup of VS Code:
<https://github.com/microsoft/vscode/blob/main/.github/workflows/ci.yml#L107>. **Make sure you updated all the workflows that may be affected.**
Now push to `osvx-publish` again. Repeat until the publish succeeds.

Now we make a copy of the publish branch "for the record":

git checkout -b old-ovsx-publish-<major>.<minor>.<patch>
git push origin

At this point, make sure the also apply all changes you had to make to get the publish to succeed in the `master` branch as well.
Triggering the workflow through the GitHub UI using the `workflow_dispatch` trigger will additionally publish the built extensions to open-vsx.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
"compile:extensions": "cross-env NODE_OPTIONS=--max-old-space-size=8192 node ./src/compile.js",
"bundle:extensions": "cross-env NODE_OPTIONS=--max-old-space-size=8192 node ./src/bundle.js",
"publish:vsix": "node ./src/publish-vsix.js",
"package-vsix:latest": "node src/package-vsix.js --tag latest",
"package-vsix:next": "node src/package-vsix.js --tag next",
"create-extension-pack:latest": "node src/create-extension-pack.js --tag latest",
"create-extension-pack:next": "node src/create-extension-pack.js --tag next",
"package-vsix": "node src/package-vsix.js",
"create-extension-pack": "node src/create-extension-pack.js",
"checkout-latest-vscode-release": "node src/checkout-latest-vscode.js",
"get-external-builtins": "node src/get-external-builtins.js",
"clean": "git clean -ffdx; cd vscode && git clean -ffdx",
Expand Down
30 changes: 13 additions & 17 deletions src/create-extension-pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@ const path = require('path');
const vsce = require('@vscode/vsce');
const yargs = require('yargs');

const { computeVersion, resolveVscodeVersion, isPublished } = require('./version');
const { resolveVscodeVersion, isPublished } = require('./version');
const { dist, extensions, run, theiaExtension } = require('./paths.js');

const { tag, force } = yargs.option('tag', {
choices: ['latest', 'next']
}).demandOption('tag')
.option('force', {
description: 'Create extension pack even if it is found to be already available',
boolean: true,
default: false
}).argv;
const { force } = yargs.option('force', {
description: 'Create extension pack even if it is found to be already available',
boolean: true,
default: false
}).argv;

const packageJson = 'package.json'
const categories = ['Extension Packs'];
Expand All @@ -55,11 +52,10 @@ const externalBuiltins = ['ms-vscode.js-debug-companion', 'ms-vscode.js-debug'];

(async () => {
const vscodeVersion = await resolveVscodeVersion();
const packVersion = await computeVersion(tag);
const extPackNameAndVersion = packName + '-' + packVersion;
const extPackNameAndVersion = packName + '-' + vscodeVersion;

const extPackVsixPath = dist(packName + '-' + packVersion + '.vsix');
const extensionPackAlreadyAvailable = await isAvailable(extPackVsixPath, packName, packVersion, publisher);
const extPackVsixPath = dist(packName + '-' + vscodeVersion + '.vsix');
const extensionPackAlreadyAvailable = await isAvailable(extPackVsixPath, packName, vscodeVersion, publisher);
if (extensionPackAlreadyAvailable && !force) {
console.log("Exiting as this extension package is already created or published: " + extPackVsixPath);
return;
Expand All @@ -74,7 +70,7 @@ const externalBuiltins = ['ms-vscode.js-debug-companion', 'ms-vscode.js-debug'];
extPack.name = packName;
extPack.displayName = packName;
extPack.description = 'Builtin extension pack associated to a version of vscode';
extPack.version = packVersion;
extPack.version = vscodeVersion;
extPack.publisher = publisher;
extPack.license = 'EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0';
extPack.categories = categories;
Expand All @@ -84,7 +80,7 @@ const externalBuiltins = ['ms-vscode.js-debug-companion', 'ms-vscode.js-debug'];

if (extPack.extensionPack.length === 0) {
process.exitCode = 1;
console.error('Aborting: No extension was found available for this version: ' + packVersion);
console.error('Aborting: No extension was found available for this version: ' + vscodeVersion);
return;
}

Expand Down Expand Up @@ -123,8 +119,8 @@ const externalBuiltins = ['ms-vscode.js-debug-companion', 'ms-vscode.js-debug'];
const content = fs.readFileSync(extDataPath, 'utf-8');
const extData = JSON.parse(content);

const extVsixPath = dist(extData.name + '-' + packVersion + '.vsix');
if (!(await isAvailable(extVsixPath, extData.name, packVersion))) {
const extVsixPath = dist(extData.name + '-' + vscodeVersion + '.vsix');
if (!(await isAvailable(extVsixPath, extData.name, vscodeVersion))) {
console.log("Skipping extension, i.e. .vsix is not found and " +
"neither published in the registry : " + extVsixPath);
continue;
Expand Down
Loading
Loading