From a3c1dfc165e9217d5d57810f6d304c7e5b417e28 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 13 Jan 2024 20:21:36 -0500 Subject: [PATCH] chore: generated release notes --- .github/workflows/ci.yml | 34 +++++++--------------------- .gitignore | 1 + scripts/generate_release_notes.ts | 37 +++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 scripts/generate_release_notes.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f81dbbd..a1fd8e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,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: | @@ -89,8 +93,10 @@ jobs: sed -i 's/dockerfile\/0.0.0/dockerfile\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/' deployment/schema.json # rename the wasm file (cd target/wasm32-unknown-unknown/release/ && mv dprint_plugin_dockerfile.wasm plugin.wasm) + # create release notes + deno run -A ./scripts/generate_release_notes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} > ${{ github.workspace }}-CHANGELOG.txt - name: Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -98,29 +104,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 `"dockerfile"` configuration property if desired. - ```jsonc - { - // ...etc... - "dockerfile": { - // config goes here - }, - "plugins": [ - "https://plugins.dprint.dev/dockerfile-${{ 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/dockerfile) + body_path: ${{ github.workspace }}-CHANGELOG.txt draft: false diff --git a/.gitignore b/.gitignore index 9b09f50..6bb0541 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target deployment/npm/buffer.generated.js deployment/npm/node_modules +.vscode diff --git a/scripts/generate_release_notes.ts b/scripts/generate_release_notes.ts new file mode 100644 index 0000000..1605162 --- /dev/null +++ b/scripts/generate_release_notes.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 = `## Changes + +${changelog} + +## 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 or run \`dprint config add dockerfile\`. +2. Add a \`"dockerfile"\` configuration property if desired. + \`\`\`jsonc + { + // ...etc... + "dockerfile": { + // config goes here + }, + "plugins": [ + "https://plugins.dprint.dev/dockerfile-${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/dockerfile) +`; + +console.log(text);