Skip to content

Commit a9784b8

Browse files
committed
ci: update CI workflow to publish on crates.io
1 parent b401c7b commit a9784b8

File tree

1 file changed

+48
-43
lines changed

1 file changed

+48
-43
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,69 @@
11
name: CI
22

3-
permissions:
4-
contents: write
5-
63
on:
74
push:
85
branches:
96
- "**" # Trigger on every branch push, excluding tags
107
tags:
118
- v[0-9]+.* # Trigger for tag pushes
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUSTFLAGS: "-Dwarnings"
1212

1313
jobs:
14-
# Job for running tests
15-
test:
16-
runs-on: ubuntu-latest
14+
check:
15+
runs-on: ubuntu-22.04
1716
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
20-
21-
- name: Set up Rust
22-
uses: actions-rs/toolchain@v1
17+
- uses: actions/checkout@v2
18+
- uses: actions-rs/toolchain@v1
2319
with:
20+
profile: minimal
2421
toolchain: stable
2522
override: true
23+
- uses: actions-rs/cargo@v1
24+
with:
25+
command: check
26+
args: --all-features --verbose
2627

27-
- name: Run tests
28-
run: cargo test --all
28+
test:
29+
runs-on: ubuntu-22.04
30+
steps:
31+
- uses: actions/checkout@v2
32+
- uses: actions-rs/toolchain@v1
33+
with:
34+
profile: minimal
35+
toolchain: stable
36+
override: true
37+
- uses: actions-rs/cargo@v1
38+
with:
39+
command: test
40+
args: --all-features --verbose
2941

30-
create-release:
31-
if: startsWith(github.ref, 'refs/tags/') # Run only for tags
32-
runs-on: ubuntu-latest
33-
needs: test
42+
clippy:
43+
runs-on: ubuntu-22.04
3444
steps:
35-
- uses: actions/checkout@v4
36-
- uses: taiki-e/create-gh-release-action@v1
45+
- uses: actions/checkout@v2
46+
- uses: actions-rs/toolchain@v1
47+
with:
48+
profile: minimal
49+
toolchain: stable
50+
components: clippy
51+
override: true
52+
- uses: actions-rs/cargo@v1
3753
with:
38-
changelog: CHANGELOG.md
39-
token: ${{ secrets.GITHUB_TOKEN }}
54+
command: clippy
55+
args: --all-features --verbose
4056

41-
upload-assets:
42-
if: startsWith(github.ref, 'refs/tags/') # Run only for tags
43-
needs: create-release
44-
strategy:
45-
matrix:
46-
include:
47-
- os: ubuntu-latest
48-
archive-suffix: "ubuntu-latest"
49-
- os: ubuntu-20.04
50-
archive-suffix: "ubuntu-20.04"
51-
- os: macos-latest
52-
archive-suffix: ""
53-
- os: windows-latest
54-
archive-suffix: ""
55-
runs-on: ${{ matrix.os }}
57+
publish:
58+
runs-on: ubuntu-22.04
59+
if: github.ref_type == 'tag'
5660
steps:
57-
- uses: actions/checkout@v4
58-
- uses: taiki-e/upload-rust-binary-action@v1
61+
- uses: actions/checkout@v2
62+
- uses: actions-rs/toolchain@v1
63+
with:
64+
profile: minimal
65+
toolchain: stable
66+
override: true
67+
- uses: katyo/publish-crates@v2
5968
with:
60-
archive: $bin-$target${{ matrix.archive-suffix }}
61-
bin: dkms
62-
tar: unix
63-
zip: windows
64-
token: ${{ secrets.GITHUB_TOKEN }}
69+
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)