-
Notifications
You must be signed in to change notification settings - Fork 14
87 lines (73 loc) · 2.12 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Release CodeSnap to crates.io
on:
push:
paths:
- core/Cargo.toml
- lib/Cargo.toml
branches:
- main
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Read version from core project
id: read_toml
uses: SebRollen/toml-action@v1.0.2
with:
file: core/Cargo.toml
field: package.version
- uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CRATES_TOKEN }}
- name: Publish library to crates.io
uses: actions-rs/cargo@v1
with:
command: publish
args: --manifest-path core/Cargo.toml
- name: Publish cli to crates.io
uses: actions-rs/cargo@v1
with:
command: publish
args: --manifest-path cli/Cargo.toml
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.read_toml.outputs.value }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
generateReleaseNotes: true
upload-assets:
needs: release
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Build and upload binaries
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: codesnap
target: ${{ matrix.target }}
tar: unix
zip: windows
token: ${{ secrets.GITHUB_TOKEN }}