-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (38 loc) · 1.14 KB
/
cargo-test-publish.yaml
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
39
40
41
42
43
44
45
46
name: Build and Release
on: [ push ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout Repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup Yaclog
run: |
pip install yaclog~=1.1
yaclog show
- name: Rust setup
run: rustup toolchain install stable --profile minimal --component rustfmt
- name: Run Checks
run: |
cargo check
cargo fmt --check
- name: Run Unit Tests
run: cargo test
- name: Publish to Crates.io
if: github.event_name == 'push'
run: |
cargo publish \
--token ${{ secrets.CARGO_TOKEN }} \
${{ github.ref_type != 'tag' && '--dry-run' || '' }}
- name: Publish to Github
if: github.event_name == 'push' && github.ref_type == 'tag'
run: |
gh release create ${{ github.ref_name }} \
--notes "$(yaclog show -mb)" \
--title "Version $(yaclog show -n)"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}