Skip to content

Commit 34b757a

Browse files
refactor: improve structure and naming in Rust build & publish workflow
1 parent 96a0dda commit 34b757a

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

.github/workflows/rust-build.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Test Rust Package
1+
name: Build, Test and Publish Rust Package
22

33
on:
44
workflow_call:
@@ -44,7 +44,6 @@ env:
4444

4545
jobs:
4646
build:
47-
name: build
4847
runs-on: ubuntu-latest
4948
steps:
5049
- name: Checkout repository
@@ -98,21 +97,21 @@ jobs:
9897
path: ${{ inputs.artifact-path }}
9998

10099
publish:
101-
needs: build
102-
if: ${{ inputs.publish-crates-io && needs.build.result == 'success' }}
103-
runs-on: ubuntu-latest
104-
steps:
105-
- name: Checkout repository
106-
uses: actions/checkout@v4
100+
needs: build
101+
if: ${{ inputs.publish-crates-io && needs.build.result == 'success' }}
102+
runs-on: ubuntu-latest
103+
steps:
104+
- name: Checkout repository
105+
uses: actions/checkout@v4
107106

108-
- name: Install Rust toolchain
109-
uses: dtolnay/rust-toolchain@stable
110-
with:
111-
toolchain: ${{ inputs.rust-version }}
112-
components: cargo
107+
- name: Install Rust toolchain
108+
uses: dtolnay/rust-toolchain@stable
109+
with:
110+
toolchain: ${{ inputs.rust-version }}
111+
components: cargo
113112

114-
- name: Validate package
115-
run: cargo package --allow-dirty
113+
- name: Validate package
114+
run: cargo package --allow-dirty
116115

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

rust-build/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787

8888
```yaml
8989
jobs:
90-
build-and-test:
90+
build-and-upload:
9191
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/rust-build.yml@main
9292
with:
9393
upload-artifact: true
@@ -99,7 +99,7 @@ jobs:
9999

100100
```yaml
101101
jobs:
102-
build-and-test:
102+
build-and-publish:
103103
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/rust-build.yml@main
104104
with:
105105
publish-crates-io: true

0 commit comments

Comments
 (0)