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