From ede7ee23ade655f259a8e552dd53e93ad972f1bc Mon Sep 17 00:00:00 2001
From: Peter van Gulik
Date: Thu, 9 May 2024 20:43:45 +0200
Subject: [PATCH] Updated config.yml
---
.circleci/config.yml | 54 +++++++++++++++++++++++++++++++-------------
1 file changed, 38 insertions(+), 16 deletions(-)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 81ab87b0..3444a307 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -9,7 +9,9 @@ commands:
checkout_install:
steps:
- checkout
- - run: corepack enable && corepack install
+ - run:
+ name: Install package manager
+ command: corepack enable && corepack install
- restore_cache:
keys:
- pnpm-store-{{ checksum "pnpm-lock.yaml" }}
@@ -41,6 +43,24 @@ commands:
build:
steps:
- run: pnpm build
+ get_version:
+ steps:
+ - run:
+ name: Get Version
+ command: |
+ VERSION=$(cat ./artifacts/.version)
+ [[ $VERSION =~ "-" ]] && export PRERELEASE="--pre-release"
+ echo ${PRERELEASE}
+ release_notes:
+ steps:
+ - run:
+ name: Get Release Notes
+ command: |
+ node -e "fs.writeFileSync('./release-notes.md', fs.readFileSync('./CHANGELOG.md').toString().match(/(##? \[(.*?))## \[/s)[1])"
+ NOTES=$(cat ./release-notes.md)
+ echo ${NOTES}
+ - store_artifacts:
+ path: release-notes.md
jobs:
build-and-test:
@@ -48,6 +68,7 @@ jobs:
- image: cimg/node:18.19-browsers
steps:
- checkout_install
+ - get_version
- build
- test
- codequality
@@ -56,34 +77,26 @@ jobs:
- image: cimg/node:18.19-browsers
steps:
- checkout_install
+ - get_version
- run:
name: "Pack extension"
- command: |
- echo $(node -p "require('./lerna.json').version") > .version
- [[ $VERSION =~ "-" ]] && export PRERELEASE="--pre-release"
- pnpm pack-extension $PRERELEASE
- - run: node -e "fs.writeFileSync('./release-notes.md', fs.readFileSync('./CHANGELOG.md').toString().match(/(##? \[(.*?))## \[/s)[1])"
+ command: pnpm pack-extension $PRERELEASE
- persist_to_workspace:
root: .
- paths: [ ".version", "release-notes.md", "packages/vscode-extension/*.vsix" ]
+ paths: [ "packages/vscode-extension/*.vsix" ]
- store_artifacts:
path: packages/vscode-extension/*.vsix
- - store_artifacts:
- path: release-notes.md
- - store_artifacts:
- path: .version
publish-vsc-extension:
docker:
- image: cimg/node:18.19-browsers
steps:
- checkout_install
+ - get_version
- attach_workspace:
at: ./artifacts
- run:
name: "Publish extension on VSCode Marketplace"
command: |
- VERSION=$(cat ./artifacts/.version)
- [[ $VERSION =~ "-" ]] && export PRERELEASE="--pre-release"
pnpx vsce publish -p "$VSCE_TOKEN" $PRERELEASE --packagePath "./artifacts/packages/vscode-extension/vlocode-${VERSION}.vsix"
publish-npm-packages:
docker:
@@ -97,15 +110,24 @@ jobs:
docker:
- image: cibuilds/github:0.13
steps:
+ - checkout
+ - get_version
+ - release_notes
- attach_workspace:
at: ./artifacts
- run:
name: "Publish Release on GitHub"
command: |
VERSION=$(cat ./artifacts/.version)
- [[ ! $VERSION =~ "^[.0-9]+$" ]] && export PRERELEASE="--prerelease"
- NOTES=$(cat ./artifacts/release-notes.md)
- ghr $PRERELEASE -t ${GITHUB_TOKEN} -b "${NOTES}" -n "Version ${VERSION}" -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete v${VERSION} ./artifacts/packages/vscode-extension/vlocode-${VERSION}.vsix
+ ghr ${PRERELEASE} \
+ -t ${GITHUB_TOKEN} \
+ -b "${NOTES}" \
+ -n "Version ${VERSION}" \
+ -u ${CIRCLE_PROJECT_USERNAME} \
+ -r ${CIRCLE_PROJECT_REPONAME} \
+ -c ${CIRCLE_SHA1} \
+ -delete v${VERSION} \
+ ./artifacts/packages/vscode-extension/vlocode-${VERSION}.vsix
workflows:
validate: