Daniel Hu 1448494934 ci: Add CircleCI configuration for automated build and publish
This commit introduces a CircleCI configuration that enables automatic building of the VSCode extension on every main branch update. It also sets up automatic publishing to the VSCode Marketplace whenever a new tag is created on the main branch. This workflow significantly improves the CI/CD process of the extension development.

Signed-off-by: Daniel Hu <tao.hu@merico.dev>
2023-05-19 10:54:07 +08:00

45 lines
964 B
YAML

version: 2.1
executors:
node-executor:
docker:
- image: cimg/node:14.15
jobs:
build:
executor: node-executor
steps:
- checkout
- run: npm install
- run: npm run build
- persist_to_workspace:
root: .
paths:
- .
publish:
executor: node-executor
steps:
- attach_workspace:
at: .
- run:
name: "Update version in package.json"
command: |
sed -i "s/\"version\": \".*\",/\"version\": \"${CIRCLE_TAG:1}\",/" package.json
- run:
name: "Publish to Marketplace"
command: npx vsce publish -p $VSCE_TOKEN
workflows:
version: 2
build-and-publish:
jobs:
- build:
filters:
branches:
only: main
- publish:
requires:
- build
filters:
tags:
only: /.*/
branches:
ignore: /.*/