name: ci
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.kind }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
CARGO_TERM_COLOR: always
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Log versions
run: |
rustc --version
cargo --version
- name: Configure cargo data directory
run: |
echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
- name: Cache
uses: actions/cache@v4
with:
path: |-
.cargo_home
target/*/.*
target/*/build
target/*/deps
key:
${{ matrix.config.os }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.config.os }}-
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo check
run: cargo check --locked
- name: Run cargo clippy
run: cargo clippy -- -D warnings
- name: Build release
run: cargo build --release --locked
- name: Pre-release (windows)
if: startsWith(matrix.os, 'windows')
run: |
Compress-Archive -CompressionLevel Optimal -Force -Path target/release/chrome_password.exe -DestinationPath target/release/chrome_password.zip
- name: Release
uses: softprops/action-gh-release@v1
if: |
startsWith(github.repository, 'justjavac') &&
startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/release/chrome_password.zip
draft: true
- name: Publish
if: |
startsWith(matrix.os, 'windows-latest') &&
startsWith(github.repository, 'justjavac') &&
startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish