-
-
Notifications
You must be signed in to change notification settings - Fork 214
115 lines (103 loc) · 3.59 KB
/
release.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: release
on:
push:
branches:
- release
paths:
- "**/Cargo.toml"
- ".github/workflows/release.yml"
jobs:
git-tag:
runs-on: ubuntu-latest
steps:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Checkout
uses: actions/checkout@v4
- name: Get releasing version
working-directory: .
run: echo NEXT_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV
- name: Check published version
run: echo PREV_VERSION=$(cargo search salvo --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV
- name: Auto tag latest version
uses: bullrich/commit-autotag@main
if: env.NEXT_VERSION != env.PREV_VERSION
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
strategy: regex
root: Cargo.toml
regex_pattern: "version\\s*=\\s*\"([0-9\\.]+)\""
tag_prefix: "v"
# version: "${{ env.NEXT_VERSION }}"
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
package:
- crate: salvo_macros
path: crates/macros
- crate: salvo_core
path: crates/core
- crate: salvo_extra
path: crates/extra
- crate: salvo-proxy
path: crates/proxy
- crate: salvo-compression
path: crates/compression
- crate: salvo-jwt-auth
path: crates/jwt-auth
- crate: salvo-session
path: crates/session
- crate: salvo-flash
path: crates/flash
- crate: salvo-cors
path: crates/cors
- crate: salvo-csrf
path: crates/csrf
- crate: salvo-cache
path: crates/cache
- crate: salvo-rate-limiter
path: crates/rate-limiter
- crate: salvo-serve-static
path: crates/serve-static
- crate: salvo-otel
path: crates/otel
- crate: salvo-oapi-macros
path: crates/oapi-macros
- crate: salvo-oapi
path: crates/oapi
- crate: salvo
path: crates/salvo
steps:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Checkout
uses: actions/checkout@v4
- name: Get releasing version
working-directory: ${{ matrix.package.path }}
run: echo NEXT_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV
- name: Check published version
run: echo PREV_VERSION=$(cargo search ${{ matrix.package.crate }} --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV
- name: Cargo login
if: env.NEXT_VERSION != env.PREV_VERSION
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: Cargo package
if: env.NEXT_VERSION != env.PREV_VERSION
working-directory: ${{ matrix.package.path }}
run: |
echo "Releasing version: $NEXT_VERSION"
echo "Published version: $PREV_VERSION"
echo "Cargo Packaging..."
cargo package
- name: Publish ${{ matrix.package.name }}
if: env.NEXT_VERSION != env.PREV_VERSION
working-directory: ${{ matrix.package.path }}
run: |
echo "Cargo Publishing..."
cargo publish --no-verify
echo "New version $NEXT_VERSION has been published"