-
-
Notifications
You must be signed in to change notification settings - Fork 15
55 lines (46 loc) · 1.28 KB
/
publish_crates.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Publish to Crates.io
on:
workflow_dispatch:
inputs:
version_type:
description: 'Version publish type'
required: true
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-make
uses: actions-rs/cargo@v1
with:
command: install
args: --force cargo-make
- name: Create publish branch
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git checkout -b publish-version-${{ github.run_number }}
- name: Publish version
run: |
if [ "${{ github.event.inputs.version_type }}" = "patch" ]; then
cargo make publish-patch
elif [ "${{ github.event.inputs.version_type }}" = "minor" ]; then
cargo make publish-minor
else
cargo make publish-major
fi