Skip to content

Commit 9ccc229

Browse files
chore(ci): rename build-profile to build-target and update cache path in Rust workflow
1 parent 34b757a commit 9ccc229

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

.github/workflows/rust-build.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
description: 'Rust version to use'
88
default: 'stable'
99
type: string
10-
build-profile:
10+
build-target:
1111
description: 'Cargo profile to use for building (debug, release)'
1212
default: 'release'
1313
type: string
@@ -36,7 +36,7 @@ on:
3636
type: string
3737
required: false
3838
secrets:
39-
CRATES_IO_TOKEN:
39+
CARGO_REGISTRY_TOKEN:
4040
required: false
4141

4242
env:
@@ -61,13 +61,12 @@ jobs:
6161
with:
6262
path: |
6363
~/.cargo/bin/
64-
~/.cargo/registry/index/
65-
~/.cargo/registry/cache/
64+
~/.cargo/registry
6665
~/.cargo/git
6766
target
68-
key: ${{ runner.os }}-cargo-${{ inputs.build-profile }}-${{ hashFiles('**/Cargo.lock') }}
67+
key: ${{ runner.os }}-cargo-${{ inputs.build-target }}-${{ hashFiles('**/Cargo.lock') }}
6968
restore-keys: |
70-
${{ runner.os }}-cargo-${{ inputs.build-profile }}-
69+
${{ runner.os }}-cargo-${{ inputs.build-target }}-
7170
7271
- name: Check formatting
7372
run: cargo fmt --all -- --check
@@ -84,10 +83,10 @@ jobs:
8483
run: cargo audit
8584

8685
- name: Build
87-
run: cargo build --profile ${{ inputs.build-profile }}
86+
run: cargo build --profile ${{ inputs.build-target }}
8887

8988
- name: Run tests
90-
run: cargo test --profile ${{ inputs.build-profile }}
89+
run: cargo test --profile ${{ inputs.build-target }}
9190

9291
- name: Upload artifact
9392
if: ${{ inputs.upload-artifact }}
@@ -111,7 +110,7 @@ jobs:
111110
components: cargo
112111

113112
- name: Validate package
114-
run: cargo package --allow-dirty
113+
run: cargo package
115114

116115
- name: Publish to crates.io
117-
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
116+
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

rust-build/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ jobs:
2424
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/rust-build.yml@main
2525
with:
2626
rust-version: 'stable'
27-
build-profile: 'release'
27+
build-target: 'release'
2828
run-audit: true
2929
enable-cache: true
3030
upload-artifact: true
3131
artifact-name: my-crate
3232
artifact-path: target/release/my-crate
3333
secrets:
34-
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
34+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3535
```
3636
3737
## Inputs
3838
3939
| Name | Description | Default | Required |
4040
| ------------------- | ------------------------------------------------------------ | --------- | -------- |
4141
| `rust-version` | Rust version to use | `stable` | No |
42-
| `build-profile` | Cargo profile to use for building (`debug`, `release`, etc.) | `release` | No |
42+
| `build-target` | Cargo profile to use for building (`debug`, `release`, etc.) | `release` | No |
4343
| `run-audit` | Run `cargo audit` for security vulnerabilities | `true` | No |
4444
| `enable-cache` | Enable caching of dependencies | `true` | No |
4545
| `upload-artifact` | Upload a build artifact after building | `false` | No |
@@ -49,9 +49,9 @@ jobs:
4949

5050
## Secrets
5151

52-
| Name | Description | Required |
53-
| ----------------- | --------------------------------------- | ------------------------------------- |
54-
| `CRATES_IO_TOKEN` | crates.io API token for `cargo publish` | Only if `publish-crates-io` is `true` |
52+
| Name | Description | Required |
53+
| -----------------------| --------------------------------------- | ------------------------------------- |
54+
| `CARGO_REGISTRY_TOKEN` | crates.io API token for `cargo publish` | Only if `publish-crates-io` is `true` |
5555

5656
## Examples
5757

@@ -73,14 +73,14 @@ jobs:
7373
run-audit: false
7474
```
7575

76-
### Use Debug Profile
76+
### Use Debug Target
7777

7878
```yaml
7979
jobs:
8080
build-and-test:
8181
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/rust-build.yml@main
8282
with:
83-
build-profile: 'debug'
83+
build-target: 'debug'
8484
```
8585

8686
### Upload Artifact After Build
@@ -95,7 +95,7 @@ jobs:
9595
artifact-path: target/release/my-crate
9696
```
9797

98-
### Publish to crates.io (requires CRATES_IO_TOKEN)
98+
### Publish to crates.io (requires CARGO_REGISTRY_TOKEN)
9999

100100
```yaml
101101
jobs:
@@ -104,5 +104,5 @@ jobs:
104104
with:
105105
publish-crates-io: true
106106
secrets:
107-
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
107+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
108108
```

0 commit comments

Comments
 (0)