From 5b4521bf06f6156d6a774f010239a8e14a32f7f1 Mon Sep 17 00:00:00 2001 From: cncsmonster Date: Thu, 26 Sep 2024 08:51:42 +0800 Subject: [PATCH] add release ci;add bin config to satisfy cargo-binstall --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 5 +++- 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..84a0023 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +env: + CARGO_TERM_COLOR: always + +jobs: + release: + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + archive: tar.gz + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - uses: dtolnay/rust-toolchain@stable + with: + target: ${{ matrix.target }} + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v2 + + - name: Build + run: cargo build --release --locked --target ${{ matrix.target }} + + - name: Pack Artifacts + env: + RELEASE_NAME: xdotter-${{ matrix.target }} + ARTIFACTS_DIR: target/${{ matrix.target }}/release + run: | + mkdir $RELEASE_NAME + cp $ARTIFACTS_DIR/xdotter -t $RELEASE_NAME + cp readme.md LICENSE -t $RELEASE_NAME + tar -zcvf $RELEASE_NAME.${{ matrix.archive }} -C $RELEASE_NAME . + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: xdotter-${{ matrix.target }}.${{ matrix.archive }} diff --git a/Cargo.lock b/Cargo.lock index 92d08b2..7708259 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -621,7 +621,7 @@ dependencies = [ [[package]] name = "xdotter" -version = "0.0.7" +version = "0.0.8" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 833d063..3cdcb62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,15 @@ [package] name = "xdotter" -version = "0.0.7" +version = "0.0.8" edition = "2021" authors = ["cncsmonster "] description = "A simple dotfile manager" license = "MIT" repository = "https://github.com/cncsmonster/xdotter" +[[bin]] +name = "xdotter" +path = "src/main.rs" [dependencies] anyhow = "1.0.86"