From 2c8343cea5f65c7e5ffa54e518aa4fba2e82b1df Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Wed, 30 Aug 2023 20:04:55 +0200 Subject: [PATCH] ci: extract changelog for GitHub release notes (#92) --- .github/workflows/pull_request.yml | 3 +-- .github/workflows/release_cli.yml | 8 ++++---- .github/workflows/release_js_api.yml | 6 ++++-- .github/workflows/release_lsp.yml | 6 ++++-- .github/workflows/website_deploy_preview.yml | 5 ++--- .github/workflows/website_deploy_prod.yml | 5 ++--- scripts/print-changelog.sh | 14 ++++++++++++++ 7 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 scripts/print-changelog.sh diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c7cc28449088..581979783fb5 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -108,8 +108,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - with: - fetch-depth: 1 + - name: Install toolchain uses: moonrepo/setup-rust@v0 - name: Build main binary diff --git a/.github/workflows/release_cli.yml b/.github/workflows/release_cli.yml index 3cfd5425778e..8c664f8d3a04 100644 --- a/.github/workflows/release_cli.yml +++ b/.github/workflows/release_cli.yml @@ -83,8 +83,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - with: - fetch-depth: 1 - name: Install Node.js uses: actions/setup-node@v3 @@ -141,8 +139,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - with: - fetch-depth: 1 - name: Install wasm-pack uses: jetli/wasm-pack-action@v0.4.0 @@ -210,6 +206,9 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Extract changelog + run: | + bash scripts/print-changelog.sh ${{ needs.build.outputs.version }} >| ${{ github.workspace }}/RELEASE_NOTES - name: Create GitHub release and tag uses: softprops/action-gh-release@v1 env: @@ -219,6 +218,7 @@ jobs: tag_name: cli/v${{ needs.build.outputs.version }} draft: false prerelease: ${{ needs.build.outputs.prerelease == 'true' }} + body_path: ${{ github.workspace }}/RELEASE_NOTES files: | biome-* fail_on_unmatched_files: true diff --git a/.github/workflows/release_js_api.yml b/.github/workflows/release_js_api.yml index 12c3516d72ff..a38a1126660c 100644 --- a/.github/workflows/release_js_api.yml +++ b/.github/workflows/release_js_api.yml @@ -59,8 +59,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - with: - fetch-depth: 1 - name: Install Node.js uses: actions/setup-node@v3 @@ -154,6 +152,9 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Extract changelog + run: | + bash scripts/print-changelog.sh ${{ needs.build.outputs.version }} >| ${{ github.workspace }}/RELEASE_NOTES - name: Create GitHub release and tag uses: softprops/action-gh-release@v1 env: @@ -163,4 +164,5 @@ jobs: tag_name: js-api/v${{ needs.build.outputs.version }} draft: false prerelease: ${{ needs.build.outputs.prerelease == 'true' }} + body_path: ${{ github.workspace }}/RELEASE_NOTES generate_release_notes: true diff --git a/.github/workflows/release_lsp.yml b/.github/workflows/release_lsp.yml index e9baadd148b3..e658954eae42 100644 --- a/.github/workflows/release_lsp.yml +++ b/.github/workflows/release_lsp.yml @@ -106,8 +106,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - with: - fetch-depth: 1 - name: Install toolchain uses: moonrepo/setup-rust@v0 @@ -228,6 +226,9 @@ jobs: env: OVSX_PAT: ${{ secrets.OVSX_PAT }} + - name: Extract changelog + run: | + bash scripts/print-changelog.sh ${{ needs.build.outputs.version }} >| ${{ github.workspace }}/RELEASE_NOTES - name: Create GitHub release and tag uses: softprops/action-gh-release@v1 env: @@ -237,6 +238,7 @@ jobs: tag_name: lsp/v${{ needs.build.outputs.version }} draft: false prerelease: ${{ needs.build.outputs.prerelease == 'true' }} + body_path: ${{ github.workspace }}/RELEASE_NOTES files: | biome_lsp-*.vsix fail_on_unmatched_files: true diff --git a/.github/workflows/website_deploy_preview.yml b/.github/workflows/website_deploy_preview.yml index 7bc8fc3f0c29..a546689df729 100644 --- a/.github/workflows/website_deploy_preview.yml +++ b/.github/workflows/website_deploy_preview.yml @@ -11,9 +11,8 @@ jobs: runs-on: ubuntu-latest environment: Website deployment steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 1 + - uses: actions/checkout@v3 + - name: Install Node.js uses: actions/setup-node@v3 with: diff --git a/.github/workflows/website_deploy_prod.yml b/.github/workflows/website_deploy_prod.yml index 51ce3a9e0f52..29ec3a25d7e8 100644 --- a/.github/workflows/website_deploy_prod.yml +++ b/.github/workflows/website_deploy_prod.yml @@ -11,9 +11,8 @@ jobs: runs-on: ubuntu-latest environment: Website deployment steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 1 + - uses: actions/checkout@v3 + - name: Install Node.js uses: actions/setup-node@v3 with: diff --git a/scripts/print-changelog.sh b/scripts/print-changelog.sh new file mode 100644 index 000000000000..0558517d9e10 --- /dev/null +++ b/scripts/print-changelog.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -eu + +# Print a changelog section (default: `Unreleased`). + +VERSION="Unreleased" + +if test -n "${1:-}" && grep -Eq "^## $1($| )" CHANGELOG.md; then + # The specified version has a dedicated section in the changelog + VERSION="$1" +fi + +# print Changelog of $VERSION +awk -v version="$VERSION" '/^## / { if (p) { exit }; if ($2 == version) { p=1; next} } p' CHANGELOG.md