1- name : Rust CI/CD
1+ name : Release CI/CD
22
33on :
44 push :
1717 name : Lint
1818 runs-on : ubuntu-latest
1919 steps :
20- - uses : actions/checkout@v3
20+ - uses : actions/checkout@v4
2121 - name : Setup Rust
2222 uses : dtolnay/rust-toolchain@stable
2323 with :
@@ -28,30 +28,30 @@ jobs:
2828 run : cargo clippy -- -D warnings
2929
3030 # Tested on multiple platforms
31- # test:
32- # name: Test
33- # needs: lint
34- # runs-on: ${{ matrix.os }}
35- # strategy:
36- # matrix:
37- # os: [ubuntu-latest, windows-latest, macos-latest]
38- # rust: [stable]
39- # steps:
40- # - uses: actions/checkout@v3
41- # - name: Setup Rust
42- # uses: dtolnay/rust-toolchain@stable
43- # with:
44- # toolchain: ${{ matrix.rust }}
45- # - name: Cargo Cache
46- # uses: actions/cache@v3
47- # with:
48- # path: |
49- # ~/.cargo/registry
50- # ~/.cargo/git
51- # target
52- # key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
53- # - name: Run Tests
54- # run: cargo test --all-features
31+ test :
32+ name : Test
33+ needs : lint
34+ runs-on : ${{ matrix.os }}
35+ strategy :
36+ matrix :
37+ os : [ubuntu-latest, windows-latest, macos-latest]
38+ rust : [stable]
39+ steps :
40+ - uses : actions/checkout@v4
41+ - name : Setup Rust
42+ uses : dtolnay/rust-toolchain@stable
43+ with :
44+ toolchain : ${{ matrix.rust }}
45+ - name : Cargo Cache
46+ uses : actions/cache@v4
47+ with :
48+ path : |
49+ ~/.cargo/registry
50+ ~/.cargo/git
51+ target
52+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
53+ - name : Run Tests
54+ run : cargo test --all-features
5555
5656 # Build binary files for different platforms.
5757 build :
@@ -72,52 +72,54 @@ jobs:
7272 target : x86_64-apple-darwin
7373 suffix : ' '
7474 steps :
75- - uses : actions/checkout@v3
75+ - uses : actions/checkout@v4
7676 - name : Setup Rust
7777 uses : dtolnay/rust-toolchain@stable
7878 - name : Build Release Binary
7979 run : cargo build --verbose --release
8080 - name : Upload Build Artifact
81- uses : actions/upload-artifact@v3
81+ uses : actions/upload-artifact@v4
8282 with :
8383 name : ${{ github.event.repository.name }}-${{ matrix.target }}
8484 path : target/release/${{ github.event.repository.name }}${{ matrix.suffix }}
8585
8686 # Post to crates.io (only when tagged)
87- # publish:
88- # name: Publish to crates.io
89- # needs: build
90- # runs-on: ubuntu-latest
91- # if: startsWith(github.ref, 'refs/tags/v')
92- # steps:
93- # - uses: actions/checkout@v3
94- # - name: Setup Rust
95- # uses: dtolnay/rust-toolchain@stable
96- # - name: Cargo Login
97- # run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
98- # - name: Cargo Publish
99- # run: cargo publish
87+ publish :
88+ name : Publish to crates.io
89+ needs : build
90+ runs-on : ubuntu-latest
91+ if : startsWith(github.ref, 'refs/tags/v')
92+ steps :
93+ - uses : actions/checkout@v4
94+ - name : Setup Rust
95+ uses : dtolnay/rust-toolchain@stable
96+ - name : Cargo Login
97+ run : cargo login ${{ secrets.CRATES_IO_TOKEN }}
98+ - name : Cargo Publish
99+ run : cargo publish
100100
101101 # Publish GitHub Release (only when tagging)
102102 github_release :
103103 name : Create GitHub Release
104104 needs : build
105105 runs-on : ubuntu-latest
106106 if : startsWith(github.ref, 'refs/tags/v')
107+ permissions :
108+ contents : write
107109 steps :
108- - uses : actions/checkout@v3
110+ - uses : actions/checkout@v4
109111 - name : Download Linux Build
110- uses : actions/download-artifact@v3
112+ uses : actions/download-artifact@v4
111113 with :
112114 name : ${{ github.event.repository.name }}-x86_64-unknown-linux-gnu
113115 path : ./linux
114116 - name : Download Windows Build
115- uses : actions/download-artifact@v3
117+ uses : actions/download-artifact@v4
116118 with :
117119 name : ${{ github.event.repository.name }}-x86_64-pc-windows-msvc
118120 path : ./windows
119121 - name : Download macOS Build
120- uses : actions/download-artifact@v3
122+ uses : actions/download-artifact@v4
121123 with :
122124 name : ${{ github.event.repository.name }}-x86_64-apple-darwin
123125 path : ./macos
0 commit comments