diff --git a/.github/workflows/offline.yml b/.github/workflows/offline.yml index 21a036a..4fcad1d 100644 --- a/.github/workflows/offline.yml +++ b/.github/workflows/offline.yml @@ -67,6 +67,34 @@ jobs: git tag ${{ env.latest_tag }} git push origin ${{ env.latest_tag }} + - name: Generate changelog + id: generate_changelog + uses: actions/github-script@v7 + with: + script: | + const { data: commits } = await github.repos.listCommits({ + owner: context.repo.owner, + repo: context.repo.repo, + per_page: 100, + sha: 'main', + }); + + const lastTagCommitSha = await github.git.getCommit({ + owner: context.repo.owner, + repo: context.repo.repo, + commit_sha: '${{ env.latest_tag }}', + }).then(({ data }) => data.sha); + + const changelog = commits + .filter(commit => commit.sha !== lastTagCommitSha) + .map(commit => `- ${commit.commit.message}`) + .join("\n"); + + return changelog || 'No significant changes.'; + + result-encoding: string + result: changelog + - name: Create GitHub release id: create_release uses: softprops/action-gh-release@v2 @@ -75,6 +103,5 @@ jobs: with: tag_name: ${{ env.latest_tag }} name: v${{ env.PACKAGE_VERSION }} - body: | - Release version ${{ env.PACKAGE_VERSION }} of the project. - files: docugrammar-offline-v${{ env.PACKAGE_VERSION }}.zip + body: ${{ steps.generate_changelog.outputs.changelog }} + files: docusaurus-offline-site-v${{ env.PACKAGE_VERSION }}.zip