Skip to content

Commit

Permalink
Update local dev version using update command
Browse files Browse the repository at this point in the history
  • Loading branch information
koliyo committed Nov 3, 2023
1 parent f31afe9 commit cf33782
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish-release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ jobs:
workflow: build-and-test.yml
name: vscode-extension-artifacts

- name: Extract version changelog
run: ./extract_version_changelog.sh ${{ github.ref_name }} >> version_changelog.txt

- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
CHANGELOG.md
LICENSE
*.vsix
body_path: version_changelog.txt
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

All notable changes to the "hylo-vscode" extension will be documented in this file.

## v0.7.2 - 2023-10-27

## v0.7.3

- Update LSP Server command will now overwrite local dev version

## v0.7.2

- Use extension path as working directory
- Allow log file to be written

## v0.7.1 - 2023-10-27
## v0.7.1

First documented release

Expand Down
14 changes: 14 additions & 0 deletions extract_version_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

start_heading="## $1"

end_heading="#"

# The file to process
file="CHANGELOG.md"

awk -v start="$start_heading" -v end="$end_heading" '
$0 ~ start {flag=1; next}
$0 ~ end {flag=0}
flag {print}
' "$file"
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Hylo",
"description": "Hylo Language Support for VSCode",
"license": "MIT",
"version": "0.7.2",
"version": "0.7.3",
"repository": {
"type": "git",
"url": "https://github.com/koliyo/hylo-vscode-extension"
Expand Down
6 changes: 3 additions & 3 deletions src/download-hylo-lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function getInstalledVersion(): VersionData | null {
}
}

export async function updateLspServer(): Promise<boolean> {
export async function updateLspServer(overwriteDev: boolean): Promise<boolean> {
try {
const releaseUrl = 'https://api.github.com/repos/koliyo/hylo-lsp/releases/latest'
const distDirectory = 'dist'
Expand All @@ -109,7 +109,7 @@ export async function updateLspServer(): Promise<boolean> {
const stdlibAssetFilename = 'hylo-stdlib.zip'
const manifestPath = `${distDirectory}/manifest.json`

wrappedOutput.appendLine(`Check for new release: ${releaseUrl}`)
wrappedOutput.appendLine(`Check for new release: ${releaseUrl}, overwriteDev: ${overwriteDev}`)

const response = await fetch(releaseUrl)
const body = await response.text()
Expand All @@ -119,7 +119,7 @@ export async function updateLspServer(): Promise<boolean> {
const localVersion = getInstalledVersion()
const target = getTargetLspFilename()

if (localVersion?.isDev) {
if (!overwriteDev && localVersion?.isDev) {
wrappedOutput.appendLine(`Dev version detected: ${localVersion}`)
return true
}
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async function activateBackend(context: ExtensionContext) {
else {
// Check if update is available
// NOTE: We continue launch process even if update fails, because we can still have working local install
await updateLspServer()
await updateLspServer(false)

// hyloRoot = hyloLpsConfig.get('rootDirectory')!
// if (!hyloRoot) {
Expand Down Expand Up @@ -162,7 +162,7 @@ export async function activate(context: ExtensionContext) {
function registerCommands() {

commands.registerCommand('hylo.updateLspServer', async () => {
await updateLspServer()
await updateLspServer(true)
})

commands.registerCommand('hylo.restartLspServer', async () => {
Expand Down

0 comments on commit cf33782

Please sign in to comment.