Skip to content

chore!: Upgrade dependencies #70

chore!: Upgrade dependencies

chore!: Upgrade dependencies #70

name: Build, test & release
on:
push:
branches:
- main
pull_request: {}
env:
APP_NAME: samling
jobs:
clippy:
name: Check for common code mistakes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy -- -D warnings
fmt:
name: Check code format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run rustfmt
continue-on-error: true
run: cargo fmt --all -- --check
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --release
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: jacobsvante/cargo-deny-action@v1
create-release-pr:
name: Conditionally create release PR
needs: [clippy, cargo-deny, test]
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
contents: write
pull-requests: write
steps:
- name: Create a release Pull Request
uses: google-github-actions/release-please-action@v3
with:
release-type: rust
command: release-pr
bump-minor-pre-major: true
publish:
name: Conditionally publish to crates.io
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
contents: write
pull-requests: write
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Make cargo command available
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Ensure publishable
run: cargo publish --dry-run
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: rust
command: github-release
token: ${{ secrets.EVENT_TRIGGERING_GITHUB_TOKEN }}
- name: Tag major and minor versions in Git
if: ${{ steps.release.outputs.release_created }}
uses: jacobsvante/tag-major-minor-action@v0
with:
major: ${{ steps.release.outputs.major }}
minor: ${{ steps.release.outputs.minor }}
- if: ${{ steps.release.outputs.release_created }}
run: cargo publish