Skip to content

Commit

Permalink
add release action
Browse files Browse the repository at this point in the history
  • Loading branch information
J-ZhengLi committed Oct 12, 2024
1 parent 762cfe6 commit e800ff1
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 11 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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"
58 changes: 58 additions & 0 deletions changelogs/CHANGELOG-0.2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<details>

<summary>Changelog</summary>

## 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
</details>
14 changes: 10 additions & 4 deletions rim_dev/src/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
"#;

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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)?;
}
}
}
}
Expand Down
18 changes: 11 additions & 7 deletions rim_dev/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ Options:

#[derive(Debug)]
enum DevCmd {
Dist { mode: DistMode },
Dist { mode: DistMode, binary_only: bool },
RunManager { no_gui: bool, args: Vec<String> },
SetVendor { vendor: String },
}

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()
Expand Down Expand Up @@ -129,16 +129,20 @@ fn main() -> Result<ExitCode> {
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") => {
Expand Down

0 comments on commit e800ff1

Please sign in to comment.