From 66e6a5bbd5c45e557d7dd3c091b11a8be3c59755 Mon Sep 17 00:00:00 2001 From: xzeldon Date: Wed, 11 Dec 2024 02:43:48 +0300 Subject: [PATCH] ci: setup github ci for releases --- .github/workflows/release.yml | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) 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..7dcf172 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Build and Publish Release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + paths-ignore: + - "**.md" + - .github/workflows/build-and-release.yml + - .gitignore + - LICENSE + - img/** + +jobs: + build-and-publish: + name: Build and Publish Release + permissions: + contents: write + runs-on: windows-latest + + steps: + - name: Checkout source code + uses: actions/checkout@v4.1.0 + + - name: Setup workflow cache + uses: actions/cache@v4.1.0 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: windows-cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} + + - name: Setup Rust stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: x86_64-pc-windows-msvc + + - name: Build + run: cargo build --release --target x86_64-pc-windows-msvc + + - name: Upload workflow artifact + uses: actions/upload-artifact@v4.1.0 + with: + name: razer-battery-report + path: ./target/x86_64-pc-windows-msvc/release/razer-battery-report.exe + if-no-files-found: error + + - name: Publish Release + uses: softprops/action-gh-release@v2.1.0 + with: + files: ./target/x86_64-pc-windows-msvc/release/razer-battery-report.exe + draft: true + fail_on_unmatched_files: true