chore: fix things up
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check (${{ matrix.toolchain }})
|
||||
@@ -17,31 +14,25 @@ jobs:
|
||||
matrix:
|
||||
toolchain: [stable, nightly]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
- name: Install Rust ${{ matrix.toolchain }}
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Cache cargo registry and build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.toml') }}
|
||||
|
||||
- name: Check formatting
|
||||
run: cargo fmt --check
|
||||
|
||||
- name: Run clippy
|
||||
run: cargo clippy -- -D warnings
|
||||
|
||||
- name: Build
|
||||
run: cargo build
|
||||
|
||||
- name: Run tests
|
||||
run: cargo test
|
||||
|
||||
@@ -1,38 +1,30 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish to crates.io
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
- name: Install Rust stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Cache cargo registry and build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.toml') }}
|
||||
|
||||
- name: Build release
|
||||
run: cargo build --release
|
||||
|
||||
- name: Run tests
|
||||
run: cargo test
|
||||
|
||||
- name: Publish to crates.io
|
||||
run: cargo publish
|
||||
env:
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
name: Version
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
version:
|
||||
name: Bump version and tag
|
||||
runs-on: ubuntu-latest
|
||||
# Skip if the push was a version bump commit (prevent infinite loop)
|
||||
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Get latest tag
|
||||
id: latest_tag
|
||||
run: |
|
||||
@@ -28,7 +23,6 @@ jobs:
|
||||
fi
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
echo "Latest tag: $tag"
|
||||
|
||||
- name: Determine version bump from commits
|
||||
id: bump
|
||||
run: |
|
||||
@@ -36,7 +30,6 @@ jobs:
|
||||
current="${latest_tag#v}"
|
||||
IFS='.' read -r major minor patch <<< "$current"
|
||||
|
||||
# Get commit messages since last tag
|
||||
if git rev-parse "$latest_tag" >/dev/null 2>&1; then
|
||||
commits=$(git log "$latest_tag"..HEAD --pretty=format:"%s")
|
||||
else
|
||||
@@ -49,6 +42,7 @@ jobs:
|
||||
fi
|
||||
|
||||
bump="none"
|
||||
|
||||
while IFS= read -r msg; do
|
||||
if echo "$msg" | grep -qiE '^feat(\(.+\))?!:|^[a-z]+(\(.+\))?!:|BREAKING CHANGE'; then
|
||||
bump="major"
|
||||
@@ -79,14 +73,12 @@ jobs:
|
||||
echo "version=$new_version" >> "$GITHUB_OUTPUT"
|
||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
||||
echo "Bump: $bump -> v$new_version"
|
||||
|
||||
- name: Update Cargo.toml version
|
||||
if: steps.bump.outputs.skip != 'true'
|
||||
run: |
|
||||
new_version="${{ steps.bump.outputs.version }}"
|
||||
sed -i "s/^version = \".*\"/version = \"$new_version\"/" Cargo.toml
|
||||
echo "Updated Cargo.toml to version $new_version"
|
||||
|
||||
- name: Commit and tag
|
||||
if: steps.bump.outputs.skip != 'true'
|
||||
run: |
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "onspring"
|
||||
version = "0.1.0"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
description = "Rust SDK for the Onspring API v2"
|
||||
description = "Rust SDK for the Onspring API"
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
|
||||
Reference in New Issue
Block a user