From 52d2c91ec40be70b6d20f26627df7ee89a42ce17 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 8 Jan 2024 18:52:08 -0500 Subject: [PATCH] chore: add generated change log to releases (#598) --- .github/workflows/ci.yml | 37 +++++++-------------------------- .gitignore | 1 + .vscode/launch.json | 27 ------------------------ .vscode/tasks.json | 11 ---------- scripts/generateReleaseNotes.ts | 37 +++++++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 67 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/tasks.json create mode 100644 scripts/generateReleaseNotes.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 848a31d5..e83aff3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,6 +105,10 @@ jobs: run: cargo publish # GITHUB RELEASE + - uses: denoland/setup-deno@v1 + if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') + with: + deno-version: v1.x - name: Pre-release if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') run: | @@ -112,8 +116,10 @@ jobs: sed -i 's/typescript\/0.0.0/typescript\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/' deployment/schema.json # rename the wasm file (cd target/wasm32-unknown-unknown/release/ && mv dprint_plugin_typescript.wasm plugin.wasm) + # create release notes + deno run -A ./scripts/generateReleaseNotes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} > ${{ github.workspace }}-CHANGELOG.txt - name: Release - uses: softprops/action-gh-release@59c3b4891632ff9a897f99a91d7bc557467a3a22 + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -121,32 +127,5 @@ jobs: files: | target/wasm32-unknown-unknown/release/plugin.wasm deployment/schema.json - body: | - ## Install - - [Install](https://dprint.dev/install/) and [setup](https://dprint.dev/setup/) dprint. - - Then in your project's dprint configuration file: - - 1. Specify the plugin url in the `"plugins"` array. - 2. Add a `"typescript"` configuration property if desired. - ```jsonc - { - // ...etc... - "typescript": { - // TypeScript & JavaScript config goes here - }, - "excludes": [ - "**/node_modules" - ], - "plugins": [ - "https://plugins.dprint.dev/typescript-${{ steps.get_tag_version.outputs.TAG_VERSION }}.wasm" - ] - } - ``` - - ## JS Formatting API - - * [JS Formatter](https://github.com/dprint/js-formatter) - Browser/Deno and Node - * [npm package](https://www.npmjs.com/package/@dprint/typescript) + body_path: ${{ github.workspace }}-CHANGELOG.txt draft: false diff --git a/.gitignore b/.gitignore index 67cec294..8c87af46 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ sourcemap deployment/npm/plugin.wasm deployment/npm/node_modules +.vscode diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 43920ab2..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Debug Tests", - "type": "lldb", - "request": "launch", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=test", - "--package=dprint-plugin-typescript" - ], - "filter": { - "name": "test", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - } - ] -} diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index cac104e1..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "tasks": [{ - "type": "shell", - "label": "cargo test build", - "command": "cargo", - "args": ["test", "--no-run"], - "problemMatcher": [ - "$rustc" - ] - }] -} diff --git a/scripts/generateReleaseNotes.ts b/scripts/generateReleaseNotes.ts new file mode 100644 index 00000000..bae437c7 --- /dev/null +++ b/scripts/generateReleaseNotes.ts @@ -0,0 +1,37 @@ +import { generateChangeLog } from "https://raw.githubusercontent.com/dprint/automation/0.9.0/changelog.ts"; + +const version = Deno.args[0]; +const changelog = await generateChangeLog({ + versionTo: version, +}); +const text = `${changelog}\n +## Install + +[Install](https://dprint.dev/install/) and [setup](https://dprint.dev/setup/) dprint. + +Then in your project's dprint configuration file: + +1. Specify the plugin url in the \`"plugins"\` array. +2. Add a \`"typescript"\` configuration property if desired. + \`\`\`jsonc + { + // ...etc... + "typescript": { + // TypeScript & JavaScript config goes here + }, + "excludes": [ + "**/node_modules" + ], + "plugins": [ + "https://plugins.dprint.dev/typescript-${version}.wasm" + ] + } + \`\`\` + +## JS Formatting API + +* [JS Formatter](https://github.com/dprint/js-formatter) - Browser/Deno and Node +* [npm package](https://www.npmjs.com/package/@dprint/typescript) +`; + +console.log(text);