From e800ff106c1a3e29d0cab9e173123242112e0d33 Mon Sep 17 00:00:00 2001 From: J-ZhengLi Date: Sat, 12 Oct 2024 17:05:04 +0800 Subject: [PATCH] add release action --- .github/workflows/release.yml | 84 +++++++++++++++++++++++++++++++++++ changelogs/CHANGELOG-0.2.0.md | 58 ++++++++++++++++++++++++ rim_dev/src/dist.rs | 14 ++++-- rim_dev/src/main.rs | 18 +++++--- 4 files changed, 163 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 changelogs/CHANGELOG-0.2.0.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ccb7027 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,84 @@ +name: Release + +on: + workflow_dispatch: + push: + tags: + - v* + +jobs: + release: + strategy: + fail-fast: false + matrix: + include: + - os: 'ubuntu-20.04' + target: x86_64-unknown-linux-gnu + - os: 'windows-latest' + target: x86_64-pc-windows-msvc + target-gnu: x86_64-pc-windows-gnu + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - name: setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: install Rust toolchain + run: rustup toolchain install stable --profile minimal --no-self-update + + - name: install dependencies (ubuntu only) + if: matrix.os == 'ubuntu-20.04' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + + - name: install cargo-tauri-cli + run: cargo install tauri-cli --version "^1" + + - name: dist + run: cargo dev dist --binary-only + + - name: prepare packages (windows) + if: matrix.os == 'windows-latest' + shell: bash + run: | + set -x + export LANG=C.UTF-8 + NAME=$(grep -Po 'vendor_en": "\K[^"]*' locales/en.json)-installer + mkdir ./dist/binaries/ + mv ./dist/${{ matrix.target-gnu }}/net-installer/$NAME-cli.exe ./dist/binaries/$NAME-cli-${{ matrix.target-gnu }}.exe + mv ./dist/${{ matrix.target-gnu }}/net-installer/$NAME.exe ./dist/binaries/$NAME-${{ matrix.target-gnu }}.exe + mv ./dist/${{ matrix.target }}/net-installer/$NAME-cli.exe ./dist/binaries/$NAME-cli-${{ matrix.target }}.exe + mv ./dist/${{ matrix.target }}/net-installer/$NAME.exe ./dist/binaries/$NAME-${{ matrix.target }}.exe + + - name: prepare packages (unix) + if: matrix.os != 'windows-latest' + shell: bash + run: | + set -x + NAME=$(grep -Po 'vendor_en": "\K[^"]*' locales/en.json)-installer + mkdir ./dist/binaries/ + mv ./dist/${{ matrix.target }}/net-installer/$NAME-cli ./dist/binaries/$NAME-cli-${{ matrix.target }} + mv ./dist/${{ matrix.target }}/net-installer/$NAME ./dist/binaries/$NAME-${{ matrix.target }} + + - name: get version + id: getVersion + run: | + VERSION=$(cargo pkgid | cut -d@ -f2) + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: upload release + uses: ncipollo/release-action@v1 + with: + artifacts: "./dist/binaries/*" + bodyFile: "changelogs/CHANGELOG-${{ steps.getVersion.outputs.version }}.md" diff --git a/changelogs/CHANGELOG-0.2.0.md b/changelogs/CHANGELOG-0.2.0.md new file mode 100644 index 0000000..5ea70b9 --- /dev/null +++ b/changelogs/CHANGELOG-0.2.0.md @@ -0,0 +1,58 @@ +
+ +Changelog + +## What's Changed +* add license by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/3 +* Frontend changed some style and layout by @wuuie in https://github.com/J-ZhengLi/custom-rust-dist/pull/40 +* finish implementing basic installation using GUI by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/41 +* Add invokeCommand to show invoke error; add global value: installConf… by @wuuie in https://github.com/J-ZhengLi/custom-rust-dist/pull/43 +* 为 `xuanwu-installer` 添加命令行调用功能;为 Tools 添加 `group_name` 及 `required` 字段 by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/44 +* 卸载`$CARGO_HOME/.cargo/bin`环境变量 by @LuuuXXX in https://github.com/J-ZhengLi/custom-rust-dist/pull/48 +* redirect "some" console output to GUI by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/46 +* wrapping up windows installation, this commit has lot of changes by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/49 +* Some various bug fixes regarding the first testing by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/61 +* add option 'quick install' by @wuuie in https://github.com/J-ZhengLi/custom-rust-dist/pull/62 +* split functionalities to `installer` and `manager`, and other fixes by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/63 +* Revert "add option 'quick install'" by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/64 +* add an `optional` field in `ToolInfo` & some bugfixes by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/66 +* fix incorrect installation/uninstall order by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/67 +* fix install_dir not passed as run_app arg by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/68 +* Reapply "add option 'quick install'" and add grouped components by @wuuie in https://github.com/J-ZhengLi/custom-rust-dist/pull/70 +* check tools availability before component selection & some bug fixes by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/71 +* fix UI thread blocking & using better installation output logging by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/72 +* fix: components group items inline by @wuuie in https://github.com/J-ZhengLi/custom-rust-dist/pull/73 +* show full component name by @wuuie in https://github.com/J-ZhengLi/custom-rust-dist/pull/75 +* reduce hardcoded string, load from manifest instead. by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/77 +* allow proxy config in manifest & some bug fixes by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/78 +* Bug fixes by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/81 +* wrapping up GUI feature & fix bug where the system PATH variable got erased by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/82 +* Edit installation method and remove fast install by @surechen in https://github.com/J-ZhengLi/custom-rust-dist/pull/84 +* fix zip extraction with prefix dirs by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/88 +* Preperation of full CLI support: Adopt i18n framework by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/97 +* [WIP] add basic interactive cli options by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/99 +* make `buildtools` installation more error aware by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/105 +* bug fixes by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/106 +* some minor fixes for windows, including `--no-gui` option not working on windows by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/107 +* add offline toolchain installation support by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/108 +* 添加记录安装工具信息的manifest by @LuuuXXX in https://github.com/J-ZhengLi/custom-rust-dist/pull/109 +* Add cli support for manager mode by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/110 +* add manager window by @wuuie in https://github.com/J-ZhengLi/custom-rust-dist/pull/111 +* 实现删除功能 by @LuuuXXX in https://github.com/J-ZhengLi/custom-rust-dist/pull/113 +* rebrand & add dev crate to make debugging and releasing much easier by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/112 +* wrapping up uninstallation on linux and enable it for release mode by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/114 +* add uninstallation support for GUI by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/116 +* Front dev update manager window by @wuuie in https://github.com/J-ZhengLi/custom-rust-dist/pull/118 +* fix misplaced detail log on GUI when install/uninstalling & fix some other bugs by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/119 +* fix various bugs & some refractoring by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/122 +* fix a problem where the not-installed components being displayed when uninstalling throght gui by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/123 +* define default&min window size by @wuuie in https://github.com/J-ZhengLi/custom-rust-dist/pull/129 +* Sync from private repo by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/133 +* unify some GUI labels, support choosing toolset manifest via commandline (for cli mode) by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/137 +* improved `rim-dev` by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/140 +* remove third-party tools from baked-in manifest except `mingw` by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/141 +* add system locale detection by @J-ZhengLi in https://github.com/J-ZhengLi/custom-rust-dist/pull/142 + +## New Contributors +* @surechen made their first contribution in https://github.com/J-ZhengLi/custom-rust-dist/pull/84 +
diff --git a/rim_dev/src/dist.rs b/rim_dev/src/dist.rs index 2afcfda..b8cc100 100644 --- a/rim_dev/src/dist.rs +++ b/rim_dev/src/dist.rs @@ -14,6 +14,8 @@ Usage: cargo dev dist [OPTIONS] Options: --cli Generate release binary for CLI mode only --gui Generate release binary for GUI mode only + -b, --binary-only + Build binary only (net-installer), skip offline package generation -h, -help Print this help message "#; @@ -131,7 +133,7 @@ impl<'a> DistWorker<'a> { } } -pub fn dist(mode: DistMode) -> Result<()> { +pub fn dist(mode: DistMode, binary_only: bool) -> Result<()> { // Get the target dir let dev_bin = env::current_exe()?; let release_dir = dev_bin.parent().unwrap().with_file_name("release"); @@ -163,11 +165,15 @@ pub fn dist(mode: DistMode) -> Result<()> { worker.dist_net_installer(Some(msvc_target))?; worker.dist_net_installer(Some(gnu_target))?; - worker.dist_noweb_installer(Some(msvc_target))?; - worker.dist_noweb_installer(Some(gnu_target))?; + if !binary_only { + worker.dist_noweb_installer(Some(msvc_target))?; + worker.dist_noweb_installer(Some(gnu_target))?; + } } else { worker.dist_net_installer(None)?; - worker.dist_noweb_installer(None)?; + if !binary_only { + worker.dist_noweb_installer(None)?; + } } } } diff --git a/rim_dev/src/main.rs b/rim_dev/src/main.rs index 9e3b620..a95ab7b 100644 --- a/rim_dev/src/main.rs +++ b/rim_dev/src/main.rs @@ -49,7 +49,7 @@ Options: #[derive(Debug)] enum DevCmd { - Dist { mode: DistMode }, + Dist { mode: DistMode, binary_only: bool }, RunManager { no_gui: bool, args: Vec }, SetVendor { vendor: String }, } @@ -57,7 +57,7 @@ enum DevCmd { impl DevCmd { fn execute(&self) -> Result<()> { match self { - Self::Dist { mode } => dist::dist(*mode)?, + Self::Dist { mode, binary_only } => dist::dist(*mode, *binary_only)?, Self::RunManager { no_gui, args } => { let mut cargo_args = if *no_gui { ["run", "--"].to_vec() @@ -129,16 +129,20 @@ fn main() -> Result { return Ok(ExitCode::SUCCESS); } "d" | "dist" => { - let mode = match args.next().as_deref() { + let mut binary_only = false; + let mut mode = DistMode::Both; + + match args.next().as_deref() { Some("-h" | "--help") => { writeln!(&mut stdout, "{DIST_HELP}")?; return Ok(ExitCode::SUCCESS); } - Some("--cli") => DistMode::Cli, - Some("--gui") => DistMode::Gui, - _ => DistMode::Both, + Some("--cli") => mode = DistMode::Cli, + Some("--gui") => mode = DistMode::Gui, + Some("-b" | "--binary-only") => binary_only = true, + _ => (), }; - DevCmd::Dist { mode } + DevCmd::Dist { mode, binary_only } } "set-vendor" => match args.next().as_deref() { Some("-h" | "--help") => {