ci: setup github ci for releases

This commit is contained in:
Timofey Gelazoniya 2024-12-11 02:43:48 +03:00
parent a418a73d3e
commit 66e6a5bbd5
Signed by: zeldon
GPG Key ID: 047886915281DD2A

58
.github/workflows/release.yml vendored Normal file
View File

@ -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