From 5549c0bd29eb4b07518306cf54367ecb0c7df918 Mon Sep 17 00:00:00 2001 From: Takase <20792268+takase1121@users.noreply.github.com> Date: Sat, 18 May 2024 07:12:04 +0800 Subject: [PATCH] Generate release notes (#1774) * ci: generate better release notes * scripts: rename generate-release-note.sh * ci/release: check out all the history * ci/release: accept version from input --- .github/workflows/release.yml | 7 +++- resources/README.md | 1 + resources/release-notes.md | 39 +++++++++++++++++ scripts/README.md | 15 +++---- scripts/generate-release-notes.sh | 69 +++++++++++++++++++++++++++++++ 5 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 resources/release-notes.md create mode 100755 scripts/generate-release-notes.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a276bf5..a1786c9d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Fetch Version id: tag run: | @@ -38,6 +40,8 @@ jobs: tag_name: ${{ steps.tag.outputs.version }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Generate Release Notes + run: bash scripts/generate-release-notes.sh --version ${{ steps.tag.outputs.version }} - name: Create Release id: create_release uses: softprops/action-gh-release@v1 @@ -45,8 +49,7 @@ jobs: tag_name: ${{ steps.tag.outputs.version }} name: Lite XL ${{ steps.tag.outputs.version }} draft: true - body_path: changelog.md - generate_release_notes: true + body_path: release-notes.md build_linux: name: Linux diff --git a/resources/README.md b/resources/README.md index d6d80eec..07969749 100644 --- a/resources/README.md +++ b/resources/README.md @@ -8,6 +8,7 @@ This folder contains resources that is used for building or packaging the projec ### Packaging +- `release-notes.md`: lite-xl release note template, used with `envsubst`. - `icons/icon.{icns,ico,inl,rc,svg}`: lite-xl icon in various formats. - `linux/com.lite_xl.LiteXL.appdata.xml`: AppStream metadata. - `linux/com.lite_xl.LiteXL.desktop`: Desktop file for Linux desktops. diff --git a/resources/release-notes.md b/resources/release-notes.md new file mode 100644 index 00000000..a1690b4b --- /dev/null +++ b/resources/release-notes.md @@ -0,0 +1,39 @@ + + +## Downloads + +- Windows (Setup): [32-bit][win32-setup], [64-bit][win64-setup] +- Linux (64-bit): [AppImage][linux64-appimage], [tarball][linux64-tarball] +- macOS: [Universal][mac-dmg], [Intel][macintel-dmg], [Apple Silicon][macarm-dmg] + +Other downloads such as ZIP files for Windows and lightweight releases are available below. + +For OS requirements, please refer to the relevant section in the [README]. + +## New Features + + + +### Fixes + + + +### Other Changes + + + +Please go to [changelog.md] for detailed description of all the changes. + + +**Commits since last version**: https://github.com/lite-xl/lite-xl/compare/v2.1.3...${RELEASE_TAG} + + +[win32-setup]: https://github.com/lite-xl/lite-xl/releases/download/${RELEASE_TAG}/LiteXL-${RELEASE_TAG}-addons-i686-setup.exe +[win64-setup]: https://github.com/lite-xl/lite-xl/releases/download/${RELEASE_TAG}/LiteXL-${RELEASE_TAG}-addons-x86_64-setup.exe +[linux64-appimage]: https://github.com/lite-xl/lite-xl/releases/download/${RELEASE_TAG}/LiteXL-${RELEASE_TAG}-addons-x86_64.AppImage +[linux64-tarball]: https://github.com/lite-xl/lite-xl/releases/download/${RELEASE_TAG}/lite-xl-${RELEASE_TAG}-addons-linux-x86_64-portable.tar.gz +[mac-dmg]: https://github.com/lite-xl/lite-xl/releases/download/${RELEASE_TAG}/lite-xl-${RELEASE_TAG}-macos-universal.dmg +[macintel-dmg]: https://github.com/lite-xl/lite-xl/releases/download/${RELEASE_TAG}/lite-xl-${RELEASE_TAG}-macos-x86_64.dmg +[macarm-dmg]: https://github.com/lite-xl/lite-xl/releases/download/${RELEASE_TAG}/lite-xl-${RELEASE_TAG}-macos-arm64.dmg +[README]: https://github.com/lite-xl/lite-xl?tab=readme-ov-file#installing-prebuilt +[changelog]: https://github.com/lite-xl/lite-xl/blob/${RELEASE_TAG}/changelog.md diff --git a/scripts/README.md b/scripts/README.md index 5910931c..36e35479 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -17,13 +17,14 @@ Various scripts and configurations used to configure, build, and package Lite XL ### Utility -- **common.sh**: Common functions used by other scripts. -- **install-dependencies.sh**: Installs required applications to build, package - and run Lite XL, mainly useful for CI and documentation purpose. - Preferably not to be used in user systems. -- **fontello-config.json**: Used by the icons generator. -- **generate_header.sh**: Generates a header file for native plugin API -- **keymap-generator**: Generates a JSON file containing the keymap +- **common.sh**: Common functions used by other scripts. +- **install-dependencies.sh**: Installs required applications to build, package + and run Lite XL, mainly useful for CI and documentation purpose. + Preferably not to be used in user systems. +- **fontello-config.json**: Used by the icons generator. +- **generate_header.sh**: Generates a header file for native plugin API +- **keymap-generator**: Generates a JSON file containing the keymap +- **generate-release-notes.sh**: Generates a release note for Lite XL releases. [1]: https://github.com/dmgbuild/dmgbuild [2]: https://docs.appimage.org/ diff --git a/scripts/generate-release-notes.sh b/scripts/generate-release-notes.sh new file mode 100755 index 00000000..da98a63b --- /dev/null +++ b/scripts/generate-release-notes.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +if [ ! -e "src/api/api.h" ]; then + echo "Please run this script from the root directory of Lite XL."; exit 1 +fi + +show_help() { + echo + echo "Release notes generator for lite-xl releases." + echo "USE IT AT YOUR OWN RISK!" + echo + echo "Usage: $0 " + echo + echo "Available options:" + echo + echo "--version Use this version instead of git tags or GitHub outputs." + echo "--debug Debug this script." + echo "--help Show this message." + echo +} + +main() { + local version + + for i in "$@"; do + case $i in + --debug) + set -x + shift + ;; + --help) + show_help + exit 0 + ;; + --version) + version="$2" + shift + shift + ;; + *) + # unknown option + ;; + esac + done + + if [[ -n $1 ]]; then + show_help + exit 0 + fi + + if [[ -z "$version" ]]; then + if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then + version="${GITHUB_REF##*/}" + else + version="$(git describe --tags $(git rev-list --tags --max-count=1))" + if [[ $? -ne 0 ]]; then version=""; fi + fi + fi + + if [[ -z "$version" ]]; then + echo "error: cannot get latest git tag" + exit 1 + fi + + export RELEASE_TAG="$version" + envsubst '$RELEASE_TAG' > release-notes.md < resources/release-notes.md +} + +main "$@"