Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 48 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,35 @@ concurrency:
cancel-in-progress: false

jobs:
# Everything downstream is keyed on this version, and publishing to crates.io
# cannot be undone. Read and check it before that point, not after, so a bad
# version costs a failed job instead of published crates with no tag, no
# release and no image.
preflight:
name: Preflight
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v6

- name: Extract and validate version
id: version
run: |
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
# Deliberately no stricter than Cargo: a version Cargo accepts must
# not fail here, or the release stops between publish and tag. Forms
# Cargo itself rejects (leading zeros, empty prerelease identifiers)
# never reach the publish step, so they need no guard of their own.
if ! printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$'; then
Comment thread
jlucaso1 marked this conversation as resolved.
Outdated
echo "Refusing to release a malformed version: '$VERSION'" >&2
exit 1
fi
echo "Releasing $VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

validate:
name: Validate
uses: ./.github/workflows/main.yml
Expand All @@ -27,7 +56,7 @@ jobs:

publish:
name: Publish to crates.io
needs: [validate, validate-e2e]
needs: [preflight, validate, validate-e2e]
runs-on: ubuntu-latest
environment: release
steps:
Expand Down Expand Up @@ -55,25 +84,18 @@ jobs:

github-release:
name: Create GitHub Release
needs: publish
needs: [preflight, publish]
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Extract version
id: version
run: |
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"

- name: Create tag
env:
RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
run: |
TAG="${{ steps.version.outputs.tag }}"
TAG="$RELEASE_TAG"
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" > /dev/null 2>&1; then
echo "Tag $TAG already exists on origin, skipping."
else
Expand All @@ -83,26 +105,32 @@ jobs:

- name: Create GitHub Release
env:
RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "${{ steps.version.outputs.tag }}" > /dev/null 2>&1; then
echo "Release ${{ steps.version.outputs.tag }} already exists, skipping."
TAG="$RELEASE_TAG"
# Hand-written notes win when the release has them: --generate-notes
# emits one bullet per PR, which for a release this size is thousands
# of lines with no structure. Falls back to the generated list so a
# release without a notes file still publishes.
NOTES=".github/release-notes/$TAG.md"
Comment thread
jlucaso1 marked this conversation as resolved.
if gh release view "$TAG" > /dev/null 2>&1; then
echo "Release $TAG already exists, skipping."
elif [ -f "$NOTES" ]; then
gh release create "$TAG" --title "$TAG" --notes-file "$NOTES" --latest
else
gh release create "${{ steps.version.outputs.tag }}" \
--title "${{ steps.version.outputs.tag }}" \
--generate-notes \
--latest
gh release create "$TAG" --title "$TAG" --generate-notes --latest
Comment thread
coderabbitai[bot] marked this conversation as resolved.
fi

# The tag pushed above with GITHUB_TOKEN can't trigger docker.yml's tag event,
# so invoke it directly and pass the version for the :X.Y.Z image tag.
publish-docker:
name: Publish Docker image
needs: github-release
needs: [preflight, github-release]
# docker.yml logs into GHCR and pushes the multi-arch image manifest.
permissions:
contents: read
packages: write
uses: ./.github/workflows/docker.yml
with:
version: ${{ needs.github-release.outputs.version }}
version: ${{ needs.preflight.outputs.version }}
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[package]
name = "whatsapp-rust"
version = "0.6.0"
version = "0.7.0"
Comment thread
jlucaso1 marked this conversation as resolved.
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down Expand Up @@ -124,13 +124,13 @@ uuid = { version = "1", default-features = false }
zeroize = { version = "1.9", default-features = false, features = ["alloc"] }

# Internal workspace crates
wacore = { path = "./wacore", default-features = false, version = "0.6.0" }
wacore-appstate = { path = "./wacore/appstate", default-features = false, version = "0.6.0" }
wacore-binary = { path = "./wacore/binary", default-features = false, version = "0.6.0" }
wacore-derive = { path = "./wacore/derive", version = "0.6.0" }
wacore-libsignal = { path = "./wacore/libsignal", version = "0.6.0" }
wacore-noise = { path = "./wacore/noise", version = "0.6.0" }
waproto = { path = "./waproto", version = "0.6.0" }
wacore = { path = "./wacore", default-features = false, version = "0.7.0" }
wacore-appstate = { path = "./wacore/appstate", default-features = false, version = "0.7.0" }
wacore-binary = { path = "./wacore/binary", default-features = false, version = "0.7.0" }
wacore-derive = { path = "./wacore/derive", version = "0.7.0" }
wacore-libsignal = { path = "./wacore/libsignal", version = "0.7.0" }
wacore-noise = { path = "./wacore/noise", version = "0.7.0" }
waproto = { path = "./waproto", version = "0.7.0" }
yoke = { version = "0.8", features = ["derive"] }
zerocopy = { version = "0.8.55", default-features = false, features = ["derive"] }
zlib-rs = { version = "0.6.6", default-features = false, features = ["std", "rust-allocator"] }
Expand Down Expand Up @@ -238,9 +238,9 @@ webrtc-dtls = { version = "0.12", optional = true }
webrtc-sctp = { version = "0.17", optional = true }
webrtc-util = { version = "0.17", optional = true }
webrtc-util-011 = { package = "webrtc-util", version = "0.11", optional = true }
whatsapp-rust-sqlite-storage = { path = "./storages/sqlite-storage", version = "0.6.0", optional = true }
whatsapp-rust-tokio-transport = { path = "./transports/tokio-transport", version = "0.6.0", optional = true }
whatsapp-rust-ureq-http-client = { path = "./http_clients/ureq-client", version = "0.6.0", optional = true }
whatsapp-rust-sqlite-storage = { path = "./storages/sqlite-storage", version = "0.7.0", optional = true }
whatsapp-rust-tokio-transport = { path = "./transports/tokio-transport", version = "0.7.0", optional = true }
whatsapp-rust-ureq-http-client = { path = "./http_clients/ureq-client", version = "0.7.0", optional = true }

# wasm32-unknown-unknown has no default getrandom backend, so make the browser
# one available (the only valid choice there) to build the crate standalone:
Expand Down
2 changes: 1 addition & 1 deletion examples/voip-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# it explicitly with `cargo run -p whatsapp-rust-voip-cli`.
[package]
name = "whatsapp-rust-voip-cli"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion http_clients/ureq-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "whatsapp-rust-ureq-http-client"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
5 changes: 4 additions & 1 deletion storages/chat-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ authors = ["João Lucas <jlucaso@hotmail.com>"]
license = "MIT"
repository = "https://github.com/jlucaso1/whatsapp-rust"
description = "SQLite-backed chat/message history store for whatsapp-rust"
# Held back from crates.io: the schema and the query surface are still moving,
# and publishing pins both. Drop this line to release it alongside the rest.
publish = false

[features]
default = []
Expand All @@ -28,7 +31,7 @@ tokio = { workspace = true, features = ["sync", "rt", "macros"] }
wacore = { workspace = true }
wacore-binary = { workspace = true }
waproto = { workspace = true }
whatsapp-rust-sqlite-storage = { path = "../sqlite-storage", version = "0.6.0" }
whatsapp-rust-sqlite-storage = { path = "../sqlite-storage", version = "0.7.0" }

[dev-dependencies]
flate2 = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion storages/sqlite-storage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "whatsapp-rust-sqlite-storage"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
2 changes: 1 addition & 1 deletion transports/tokio-transport/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "whatsapp-rust-tokio-transport"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
2 changes: 1 addition & 1 deletion wacore/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wacore"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
2 changes: 1 addition & 1 deletion wacore/appstate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wacore-appstate"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
2 changes: 1 addition & 1 deletion wacore/binary/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wacore-binary"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
2 changes: 1 addition & 1 deletion wacore/derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wacore-derive"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
2 changes: 1 addition & 1 deletion wacore/libsignal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wacore-libsignal"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
2 changes: 1 addition & 1 deletion wacore/noise/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wacore-noise"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
2 changes: 1 addition & 1 deletion waproto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "waproto"
version = "0.6.0"
version = "0.7.0"
edition = "2024"
rust-version.workspace = true
authors = ["João Lucas <jlucaso@hotmail.com>"]
Expand Down
Loading