generated from habedi/template-rust-project
-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (30 loc) · 880 Bytes
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Publish to Crates.io
on:
workflow_dispatch: { } # Allow manual execution
push:
tags:
- 'v*' # Trigger on version tags
jobs:
# Run tests before publishing and only publish if tests pass
call_tests:
uses: ./.github/workflows/tests.yml
publish:
runs-on: ubuntu-latest
# Try to publish only if the tests pass
needs: call_tests
if: success()
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Publish to Crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
sudo apt-get update
sudo apt-get install -y make
cargo publish --token $CARGO_REGISTRY_TOKEN
continue-on-error: false