diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4c5364..4ecb554 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: features: [--no-default-features, --all-features] steps: - name: Checkout sources - uses: actions/checkout@v1 + uses: actions/checkout@v5 - name: Install ${{ matrix.toolchain }} toolchain run: | @@ -20,17 +20,14 @@ jobs: rustup default ${{ matrix.toolchain }} - name: Run cargo check - uses: actions-rs/cargo@v1 - with: - command: check - args: ${{ matrix.features }} --workspace + run: cargo check ${{ matrix.features }} --workspace no-std: name: no_std Check runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v1 + uses: actions/checkout@v5 - name: Install nightly toolchain run: | @@ -38,24 +35,15 @@ jobs: rustup default nightly - name: Install cargo no-std-check - uses: actions-rs/cargo@v1 - with: - command: install - args: cargo-no-std-check + run: cargo install cargo-no-std-check # https://github.com/mystor/cargo-no-std-check/issues/2 # `--no-default-features` doesn't work with `--workspace` correctly. - name: Run cargo no-std-check on libflate crate - uses: actions-rs/cargo@v1 - with: - command: no-std-check - args: --no-default-features + run: cargo no-std-check --no-default-features - name: Run cargo no-std-check on libflate_lz77 crate - uses: actions-rs/cargo@v1 - with: - command: no-std-check - args: --no-default-features --manifest-path libflate_lz77/Cargo.toml + run: cargo no-std-check --no-default-features --manifest-path libflate_lz77/Cargo.toml test: name: Test Suite @@ -66,7 +54,7 @@ jobs: features: [--no-default-features, --all-features] steps: - name: Checkout sources - uses: actions/checkout@v1 + uses: actions/checkout@v5 - name: Install ${{ matrix.toolchain }} toolchain run: | @@ -74,10 +62,7 @@ jobs: rustup default ${{ matrix.toolchain }} - name: Run cargo test - uses: actions-rs/cargo@v1 - with: - command: test - args: ${{ matrix.features }} --workspace + run: cargo test ${{ matrix.features }} --workspace lints: name: Lints @@ -88,7 +73,7 @@ jobs: features: [--no-default-features, --all-features] steps: - name: Checkout sources - uses: actions/checkout@v1 + uses: actions/checkout@v5 - name: Install ${{ matrix.toolchain }} toolchain run: | @@ -97,14 +82,8 @@ jobs: rustup component add rustfmt clippy - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check - name: Run cargo clippy if: matrix.toolchain != 'beta' - uses: actions-rs/cargo@v1 - with: - command: clippy - args: ${{ matrix.features }} --workspace -- -D warnings + run: cargo clippy ${{ matrix.features }} --workspace -- -D warnings diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..feef18c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Create GitHub Release and Publish to crates.io + +on: + push: + tags: ['v*'] + +jobs: + github-release: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v5 + - id: create-release + run: gh release create ${{ github.ref_name }} --title "${{ github.ref_name }}" --generate-notes + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + publish: + needs: github-release + runs-on: ubuntu-latest + # environment: release # Optional: for enhanced security + permissions: + id-token: write + steps: + - uses: actions/checkout@v5 + - uses: rust-lang/crates-io-auth-action@v1 + id: auth + - run: cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} diff --git a/Cargo.toml b/Cargo.toml index de15b19..ea91efa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,10 +11,10 @@ categories = ["compression", "no-std"] license = "MIT" edition = "2021" include = [ - 'Cargo.toml', - 'README.md', - 'LICENSE', - 'src/**/*.rs', + "Cargo.toml", + "README.md", + "LICENSE", + "src/**/*.rs", ] [dependencies]