Skip to content

Commit 9ae5ff2

Browse files
authored
rust(chore) Updated github action workflow (#324)
1 parent 28f9508 commit 9ae5ff2

3 files changed

Lines changed: 44 additions & 132 deletions

File tree

.github/workflows/rust_ci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ on:
88
branches:
99
- main
1010
workflow_call:
11+
inputs:
12+
ref:
13+
description: "Git ref (tag or sha) to check out and test"
14+
required: false
15+
type: string
1116

1217
jobs:
1318
lint-rust:
1419
runs-on: ubuntu-latest
1520
steps:
1621
- name: Checkout sources
1722
uses: actions/checkout@v2
23+
with:
24+
ref: ${{ inputs.ref || github.sha }}
1825

1926
- name: Install stable toolchain
2027
uses: actions-rs/toolchain@v1

.github/workflows/rust_release.yaml

Lines changed: 19 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,32 @@ name: Crates Publish
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: "Optional git tag or commit SHA to publish from"
8+
type: string
9+
required: false
510

611
jobs:
712
rust-ci:
8-
if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags')
913
uses: ./.github/workflows/rust_ci.yaml
14+
with:
15+
ref: ${{ github.event.inputs.ref }}
1016

11-
publish-to-crates-io-sift_rs:
17+
publish-to-crates-io:
1218
runs-on: ubuntu-latest
13-
name: Publish to crates.io for sift_rs
19+
name: Publish to crates.io for the sift rust libraries
1420
needs: rust-ci
1521
environment:
1622
name: crates.io
1723
steps:
18-
- uses: actions/checkout@v3
19-
- uses: actions-rs/toolchain@v1
20-
with:
21-
toolchain: stable
22-
override: true
23-
- uses: katyo/publish-crates@v2
24-
with:
25-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
26-
path: './rust/crates/sift_rs'
27-
28-
publish-to-crates-io-sift_error:
29-
runs-on: ubuntu-latest
30-
name: Publish to crates.io for sift_error
31-
needs: rust-ci
32-
environment:
33-
name: crates.io
34-
steps:
35-
- uses: actions/checkout@v3
36-
- uses: actions-rs/toolchain@v1
37-
with:
38-
toolchain: stable
39-
override: true
40-
- uses: katyo/publish-crates@v2
41-
with:
42-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
43-
path: './rust/crates/sift_error'
44-
45-
publish-to-crates-io-sift_connect:
46-
runs-on: ubuntu-latest
47-
name: Publish to crates.io for sift_connect
48-
needs: rust-ci
49-
environment:
50-
name: crates.io
51-
steps:
52-
- uses: actions/checkout@v3
53-
- uses: actions-rs/toolchain@v1
54-
with:
55-
toolchain: stable
56-
override: true
57-
- uses: katyo/publish-crates@v2
58-
with:
59-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
60-
path: './rust/crates/sift_connect'
61-
62-
publish-to-crates-io-sift_stream:
63-
runs-on: ubuntu-latest
64-
name: Publish to crates.io for sift_stream
65-
needs: rust-ci
66-
environment:
67-
name: crates.io
68-
steps:
69-
- uses: actions/checkout@v3
70-
- uses: actions-rs/toolchain@v1
71-
with:
72-
toolchain: stable
73-
override: true
74-
- uses: katyo/publish-crates@v2
75-
with:
76-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
77-
path: './rust/crates/sift_stream'
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.event.inputs.ref || github.sha }}
28+
- name: Install stable toolchain
29+
uses: dtolnay/rust-toolchain@stable
30+
- name: Publish crates
31+
run: cargo publish --workspace --exclude sift-stream-bindings --manifest-path ./rust/Cargo.toml --locked --token ${CARGO_REGISTRY_TOKEN}
32+
env:
33+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/rust_release_dry_run.yaml

Lines changed: 18 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,81 +2,30 @@ name: Crates Publish (Dry Run)
22

33
on:
44
workflow_dispatch:
5-
workflow_call:
5+
inputs:
6+
ref:
7+
description: "Optional git tag or commit SHA to publish from"
8+
type: string
9+
required: false
610

711
jobs:
812
rust-ci:
9-
if: github.event_name == 'workflow_dispatch'
1013
uses: ./.github/workflows/rust_ci.yaml
11-
12-
publish-to-crates-io-dry-run-sift_rs:
13-
runs-on: ubuntu-latest
14-
name: Do a dry run publish to crates.io for sift_rs
15-
needs: rust-ci
16-
environment:
17-
name: crates.io (dry run)
18-
steps:
19-
- uses: actions/checkout@v3
20-
- uses: actions-rs/toolchain@v1
21-
with:
22-
toolchain: stable
23-
override: true
24-
- uses: katyo/publish-crates@v2
25-
with:
26-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
27-
path: './rust/crates/sift_rs'
28-
dry-run: true
29-
30-
publish-to-crates-io-dry-run-sift_error:
14+
with:
15+
ref: ${{ github.event.inputs.ref }}
16+
17+
publish-to-crates-io-dry-run:
3118
runs-on: ubuntu-latest
32-
name: Do a dry run publish to crates.io for sift_error
19+
name: Do a dry run publish to crates.io for the sift rust libraries
3320
needs: rust-ci
3421
environment:
3522
name: crates.io (dry run)
3623
steps:
37-
- uses: actions/checkout@v3
38-
- uses: actions-rs/toolchain@v1
39-
with:
40-
toolchain: stable
41-
override: true
42-
- uses: katyo/publish-crates@v2
43-
with:
44-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
45-
path: './rust/crates/sift_error'
46-
dry-run: true
47-
48-
publish-to-crates-io-dry-run-sift_connect:
49-
runs-on: ubuntu-latest
50-
name: Do a dry run publish to crates.io for sift_connect
51-
needs: rust-ci
52-
environment:
53-
name: crates.io (dry run)
54-
steps:
55-
- uses: actions/checkout@v3
56-
- uses: actions-rs/toolchain@v1
57-
with:
58-
toolchain: stable
59-
override: true
60-
- uses: katyo/publish-crates@v2
61-
with:
62-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
63-
path: './rust/crates/sift_connect'
64-
dry-run: true
65-
66-
publish-to-crates-io-dry-run-sift_stream:
67-
runs-on: ubuntu-latest
68-
name: Do a dry run publish to crates.io for sift_stream
69-
needs: rust-ci
70-
environment:
71-
name: crates.io (dry run)
72-
steps:
73-
- uses: actions/checkout@v3
74-
- uses: actions-rs/toolchain@v1
75-
with:
76-
toolchain: stable
77-
override: true
78-
- uses: katyo/publish-crates@v2
79-
with:
80-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
81-
path: './rust/crates/sift_stream'
82-
dry-run: true
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.event.inputs.ref || github.sha }}
28+
- name: Install stable toolchain
29+
uses: dtolnay/rust-toolchain@stable
30+
- name: Publish crates (dry run)
31+
run: cargo publish --workspace --exclude sift-stream-bindings --manifest-path ./rust/Cargo.toml --locked --dry-run

0 commit comments

Comments
 (0)