From 7d457f8fc5ed44558bd2f8241c21f67a31ec14dd Mon Sep 17 00:00:00 2001 From: Takase <20792268+takase1121@users.noreply.github.com> Date: Sat, 16 Nov 2024 14:10:24 +0800 Subject: [PATCH] Fix multiple continuous release binaries (#1948) * ci,scripts: remove unused lua patching code * ci: remove old continuous release binaries * ci: generate release notes when releasing with tags * ci: remove the unicode patch flag * ci: add content: write permission to GH_TOKEN * ci: use ncipollo/release-action@v1 * ci: update existing releases * ci: actually set removeArtifacts to true * ci: do not rebuild for both bundle and portable We now allow using meson setup --reconfigure, which will preserve the build cache, and changes nothing but the installation path * build.sh: fix wrong conditional * ci: fix tar command output * ci: fix tar command extracting to wrong directory * ci: add merge-multiple: true to properly lay out the artifacts * ci: only upload the correct files --- .github/workflows/build.yml | 97 +++++++++++++++++-------------------- scripts/build.sh | 27 +++++------ 2 files changed, 58 insertions(+), 66 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 154676ca..4b9eff42 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,8 @@ jobs: outputs: release: ${{ steps.check_release.outputs.release }} ref: ${{ steps.check_release.outputs.ref }} + permissions: + contents: write steps: - name: Update Tag uses: richardsimko/update-tag@v1 @@ -58,10 +60,8 @@ jobs: strategy: matrix: config: - - { runner: macos-13, type: bundle, arch: x86_64-darwin } - - { runner: macos-13, type: portable, arch: x86_64-darwin } - - { runner: macos-14, type: bundle, arch: aarch64-darwin } - - { runner: macos-14, type: portable, arch: aarch64-darwin } + - { runner: macos-13, arch: x86_64-darwin } + - { runner: macos-14, arch: aarch64-darwin } runs-on: ${{ matrix.config.runner }} steps: - name: System Information @@ -80,24 +80,23 @@ jobs: - name: Install Dependencies run: scripts/install-dependencies.sh - - name: Build - run: scripts/build.sh --addons --debug --forcefallback --${{ matrix.config.type }} -b build - - - name: Package Mac (Bundle) - if: ${{ matrix.config.type == 'bundle' }} - run: cd build && tar -czvf ../lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }}}-${{ matrix.config.type }}.tar.gz lite-xl Info.plist + - name: Build & Package Mac (Bundle) + run: | + scripts/build.sh --addons --debug --forcefallback --reconfigure --bundle -b build + tar -C build -czvf lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }}-bundle.tar.gz lite-xl Info.plist - - name: Package Mac (Portable) - if: ${{ matrix.config.type == 'portable' }} - run: cd build && tar -czvf ../lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }}}-${{ matrix.config.type }}.tar.gz lite-xl + - name: Build & Package Mac (Portable) + run: | + scripts/build.sh --addons --debug --forcefallback --reconfigure --portable -b build + tar -C build -czvf lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }}-portable.tar.gz lite-xl - name: Upload (Intermediate) uses: actions/upload-artifact@v4 with: - name: lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }}-${{ matrix.config.type }} + name: lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }} path: | *.tar.gz - + build_darwin_universal: name: Darwin (Universal) @@ -117,12 +116,14 @@ jobs: uses: actions/download-artifact@v4 with: pattern: '*darwin*' + merge-multiple: true - name: Create Universal Binaries run: | for TYPE in bundle portable; do - mkdir -p lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-$TYPE/lite-xl - cd lite-xl-${{ needs.version.outputs.ref }}-x86_64-darwin-$TYPE && tar -zxvf *.tar.gz && cd .. && cd lite-xl-${{ needs.version.outputs.ref }}-aarch64-darwin-$TYPE && tar -zxvf *.tar.gz && cd .. + mkdir -p lite-xl-${{ needs.version.outputs.ref }}-{x86_64,aarch64,universal}-darwin-$TYPE/lite-xl + tar -C lite-xl-${{ needs.version.outputs.ref }}-x86_64-darwin-$TYPE -zxvf lite-xl-${{ needs.version.outputs.ref }}-x86_64-darwin-$TYPE.tar.gz + tar -C lite-xl-${{ needs.version.outputs.ref }}-aarch64-darwin-$TYPE -zxvf lite-xl-${{ needs.version.outputs.ref }}-aarch64-darwin-$TYPE.tar.gz cp -r lite-xl-${{ needs.version.outputs.ref }}-*-$TYPE/lite-xl/data lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-$TYPE/lite-xl lipo -create -output lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-$TYPE/lite-xl/lite-xl lite-xl-${{ needs.version.outputs.ref }}-*-darwin-$TYPE/lite-xl/lite-xl done @@ -139,8 +140,8 @@ jobs: with: name: lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-release path: | - *.dmg - *.tar.gz + lite-xl-${{ needs.version.outputs.ref }}-universal-darwin.dmg + lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-portable.tar.gz build_linux: @@ -187,7 +188,7 @@ jobs: run: bash scripts/install-dependencies.sh - name: Build - run: bash scripts/build.sh -U --addons --debug --forcefallback --portable -b build + run: bash scripts/build.sh --addons --debug --forcefallback --portable -b build - name: Package Windows (Portable) run: cd build && zip -r ../lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows-portable.zip lite-xl && cd .. @@ -203,6 +204,7 @@ jobs: *.zip *.exe + build_windows_msvc: name: Windows (x86_64) (MSVC) needs: [version] @@ -222,25 +224,15 @@ jobs: - name: Install meson and ninja run: pip install meson ninja - - name: Set up environment variables - run: | - "LUA_SUBPROJECT_PATH=subprojects/$(awk -F ' *= *' '/directory/ { printf $2 }' subprojects/lua.wrap)" >> $env:GITHUB_ENV - - - name: Download subprojects - shell: bash - run: | - meson subprojects download - - name: Configure run: meson setup --wrap-mode=forcefallback build - name: Build - run: meson install -C build --destdir="../lite-xl" + run: meson install -C build --skip-subprojects --destdir="../lite-xl" - name: Package - run: | - Remove-Item -Recurse -Force -Path "lite-xl/lib","lite-xl/include" - Compress-Archive -Path lite-xl -DestinationPath "lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows.zip" + shell: powershell {0} + run: Compress-Archive -Path lite-xl -DestinationPath "lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows.zip" - name: Upload Artifacts (Intermediate) uses: actions/upload-artifact@v4 @@ -255,28 +247,31 @@ jobs: name: Create Release needs: [version, build_linux, build_windows, build_darwin_universal] runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 - name: Download Artifacts uses: actions/download-artifact@v4 with: pattern: lite-xl-*-release - path: . + merge-multiple: true + path: releases + - name: Generate Release Notes + if: needs.version.outputs.release + env: + GH_TOKEN: ${{ github.token }} + run: bash scripts/generate-release-notes.sh --version ${{ needs.version.outputs.release }} - name: Versioned Release - uses: softprops/action-gh-release@v2 + uses: ncipollo/release-action@v1 if: ${{ needs.version.outputs.release }} with: - tag_name: ${{ needs.version.outputs.release }} + tag: ${{ needs.version.outputs.release }} name: Lite XL ${{ needs.version.outputs.release }} draft: true - body_path: changelog.md - generate_release_notes: true - files: | - */*.tar.gz - */*.zip - */*.exe - */*.dmg - */*.AppImage + allowUpdates: true + bodyFile: release-notes.md + artifacts: "releases/*.*" - name: Update Tag uses: richardsimko/update-tag@v1 if: github.ref == 'refs/heads/master' @@ -285,15 +280,13 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Continuous Release - uses: softprops/action-gh-release@v2 + uses: ncipollo/release-action@v1 if: github.ref == 'refs/heads/master' with: name: Lite XL Continuous Release - tag_name: continuous + tag: continuous prerelease: true - files: | - */*.tar.gz - */*.zip - */*.exe - */*.dmg - */*.AppImage + allowUpdates: true + removeArtifacts: true + generateReleaseNotes: true + artifacts: "releases/*.*" diff --git a/scripts/build.sh b/scripts/build.sh index 62873978..851342bf 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -23,8 +23,9 @@ show_help() { echo "-B --bundle Create an App bundle (macOS only)" echo "-A --addons Add in addons" echo "-P --portable Create a portable binary package." + echo "-r --reconfigure Tries to reuse the meson build directory, if possible." + echo " Default: Deletes the build directory and recreates it." echo "-O --pgo Use profile guided optimizations (pgo)." - echo "-U --windows-lua-utf Use the UTF8 patch for Lua." echo " macOS: disabled when used with --bundle," echo " Windows: Implicit being the only option." echo " --cross-platform PLATFORM Cross compile for this platform." @@ -49,13 +50,12 @@ main() { local bundle local portable local pgo - local patch_lua local cross local cross_platform local cross_arch local cross_file - - local lua_subproject_path + local reconfigure + local should_reconfigure for i in "$@"; do case $i in @@ -72,6 +72,10 @@ main() { build_type="debug" shift ;; + -r|--reconfigure) + should_reconfigure=true + shift + ;; --debug) set -x shift @@ -105,10 +109,6 @@ main() { pgo="-Db_pgo=generate" shift ;; - -U|--windows-lua-utf) - patch_lua="true" - shift - ;; --cross-arch) cross="true" cross_arch="$2" @@ -186,12 +186,10 @@ main() { export LDFLAGS="-mmacosx-version-min=$macos_version_min" fi - rm -rf "${build_dir}" - - if [[ $patch_lua == "true" ]] && [[ ! -z $force_fallback ]]; then - # download the subprojects so we can start patching before configure. - # this will prevent reconfiguring the project. - meson subprojects download + if [[ $should_reconfigure == true ]] && [[ -d "${build_dir}" ]]; then + reconfigure="--reconfigure" + elif [[ -d "${build_dir}" ]]; then + rm -rf "${build_dir}" fi CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \ @@ -203,6 +201,7 @@ main() { $bundle \ $portable \ $pgo \ + $reconfigure meson compile -C "${build_dir}"