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