Skip to content

Commit df84f91

Browse files
lovasoacursoragent
andauthored
Update publish action for workspace publishing (#38)
* feat: Add CI workflow for publishing and dry-runs Co-authored-by: contact <[email protected]> * Refactor publish workflow and remove dry-run script Co-authored-by: contact <[email protected]> * Refine publish workflow to only publish tagged versions Co-authored-by: contact <[email protected]> * simple publish workspace with dry run * Refactor publish workflow for improved readability and maintainability * Fix publish workflow to correctly handle dry-run flag for non-tagged versions * Update Cargo.toml to include additional runtime dependencies for async-std and tokio with native-tls and rustls support * Update Cargo.toml to set publish flag to false and add runtime dependencies for actix and async-std with rustls support --------- Co-authored-by: Cursor Agent <[email protected]>
1 parent d82bd8e commit df84f91

File tree

12 files changed

+38
-16
lines changed

12 files changed

+38
-16
lines changed

.github/workflows/publish.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1+
name: Publish workspace crates
2+
13
on:
24
workflow_dispatch: {}
35
push:
4-
# Sequence of patterns matched against refs/tags
6+
paths:
7+
- "**/Cargo.toml"
8+
- ".github/workflows/publish.yml"
59
tags:
6-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7-
8-
name: Publish
10+
- "v*"
11+
pull_request:
12+
paths:
13+
- "**/Cargo.toml"
14+
- ".github/workflows/publish.yml"
915

1016
jobs:
1117
publish:
12-
name: Publish
13-
runs-on: ubuntu-22.04
18+
runs-on: ubuntu-latest
1419
steps:
1520
- uses: actions/checkout@v4
21+
- uses: dtolnay/rust-toolchain@stable
1622
- uses: Swatinem/rust-cache@v2
17-
- run: |
18-
cargo publish ${ARGS} --package sqlx-rt-oldapi
19-
cargo publish ${ARGS} --package sqlx-core-oldapi
20-
cargo publish ${ARGS} --package sqlx-macros-oldapi
21-
cargo publish ${ARGS} --package sqlx-oldapi
22-
env:
23-
ARGS:
24-
--token ${{ secrets.CRATES_TOKEN }}
25-
--no-default-features
26-
--features runtime-actix-rustls
23+
- name: Publish workspace
24+
run: |
25+
cargo publish \
26+
${{ startsWith(github.ref, 'refs/tags/v') && '' || '--dry-run' }} \
27+
--workspace \
28+
--token ${{ secrets.CRATES_TOKEN }} \
29+
--no-default-features \
30+
--features runtime-actix-rustls

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ runtime-actix-native-tls = ["runtime-tokio-native-tls"]
8383
runtime-async-std-native-tls = [
8484
"sqlx-core/runtime-async-std-native-tls",
8585
"sqlx-macros/runtime-async-std-native-tls",
86+
"sqlx-rt/runtime-async-std-native-tls",
8687
"_rt-async-std",
8788
]
8889
runtime-tokio-native-tls = [
@@ -95,25 +96,29 @@ runtime-actix-rustls = ["runtime-tokio-rustls"]
9596
runtime-async-std-rustls = [
9697
"sqlx-core/runtime-async-std-rustls",
9798
"sqlx-macros/runtime-async-std-rustls",
99+
"sqlx-rt/runtime-async-std-rustls",
98100
"aws_lc_rs",
99101
"tls12",
100102
"_rt-async-std",
101103
]
102104
runtime-async-std-rustls-nocrypto = [
103105
"sqlx-core/runtime-async-std-rustls",
104106
"sqlx-macros/runtime-async-std-rustls",
107+
"sqlx-rt/runtime-async-std-rustls",
105108
"_rt-async-std",
106109
]
107110
runtime-tokio-rustls = [
108111
"sqlx-core/runtime-tokio-rustls",
109112
"sqlx-macros/runtime-tokio-rustls",
113+
"sqlx-rt/runtime-tokio-rustls",
110114
"aws_lc_rs",
111115
"tls12",
112116
"_rt-tokio",
113117
]
114118
runtime-tokio-rustls-nocrypto = [
115119
"sqlx-core/runtime-tokio-rustls",
116120
"sqlx-macros/runtime-tokio-rustls",
121+
"sqlx-rt/runtime-tokio-rustls",
117122
"_rt-tokio",
118123
]
119124

examples/mysql/todos/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "sqlx-example-mysql-todos"
33
version = "0.1.0"
44
edition = "2021"
5+
publish = false
56
workspace = "../../../"
67

78
[dependencies]

examples/postgres/axum-social-with-tests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "sqlx-example-postgres-axum-social"
33
version = "0.1.0"
44
edition = "2021"
5+
publish = false
56

67
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
78

examples/postgres/files/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "files"
33
version = "0.1.0"
44
edition = "2021"
5+
publish = false
56

67
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
78

examples/postgres/json/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "json"
33
version = "0.1.0"
44
edition = "2021"
5+
publish = false
56
workspace = "../../../"
67

78
[dependencies]

examples/postgres/listen/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "sqlx-example-postgres-listen"
33
version = "0.1.0"
44
edition = "2021"
5+
publish = false
56
workspace = "../../../"
67

78
[dependencies]

examples/postgres/mockable-todos/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "sqlx-example-postgres-mockable-todos"
33
version = "0.1.0"
44
edition = "2021"
5+
publish = false
56
workspace = "../../../"
67

78
[dependencies]

examples/postgres/todos/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "sqlx-example-postgres-todos"
33
version = "0.1.0"
44
edition = "2018"
5+
publish = false
56
workspace = "../../../"
67

78
[dependencies]

examples/postgres/transaction/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "sqlx-example-postgres-transaction"
33
version = "0.1.0"
44
edition = "2021"
5+
publish = false
56
workspace = "../../../"
67

78
[dependencies]

0 commit comments

Comments
 (0)