diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e4b13c..69148fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,25 +1,26 @@ name: Release +# Run from the Actions tab after the version bump is merged to main. +# `rake release` builds the gem, creates and pushes the vX.Y.Z tag, and +# publishes to RubyGems with trusted publishing (rubygems/release-gem). on: - push: - tags: ["v*"] + workflow_dispatch: jobs: release: + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest environment: rubygems permissions: - contents: write - id-token: write + contents: write # push the release tag + id-token: write # trusted publishing steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 + with: + persist-credentials: false - uses: ruby/setup-ruby@v1 with: ruby-version: "3.4" bundler-cache: true - run: bundle exec rake test - - name: Check the tag matches the gem version - run: | - version=$(ruby -r ./lib/smswire/version -e 'print Smswire::VERSION') - test "v${version}" = "${GITHUB_REF_NAME}" || { echo "Tag ${GITHUB_REF_NAME} does not match version ${version}"; exit 1; } - uses: rubygems/release-gem@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index a0b68c3..7411b20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,79 +1,74 @@ # Changelog All notable changes to this project are documented here. The format follows -[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow +[Semantic Versioning](https://semver.org/). Before 1.0, minor versions may +include breaking changes, which are called out here. ## [Unreleased] -### Added - -- Guides: getting started, migrating from twilio-ruby, migrating from - Noticed's Twilio method, compliance primer, and writing a provider. -- `Smswire.verify_credentials!` with checks for Twilio, Telnyx, and Vonage. -- `support_contact` for HELP replies and `opt_out_all_scopes`. -- Release workflow publishing to RubyGems with trusted publishing. - -### Changed - -- Keyword replies follow CTIA guidance: the opt-out confirmation says no - further messages will be sent, and HELP names a support contact. -- Keywords ignore internal spaces and hyphens, so "opt out" and "stop all" match. -- Noticed adapter job options are `sms_queue` and `sms_priority`, so Noticed's - own `wait` no longer delays a message twice. - -- Telnyx adapter (Messaging API v2) with Ed25519 webhook verification. -- Vonage adapter (SMS API) with signed webhook verification for `md5hash` and - HMAC methods. -- `Smswire::ProviderContract`, a shipped Minitest suite every adapter passes; - the provider generator now writes a test that runs it. -- `Noticed::DeliveryMethods::Smswire` for `deliver_by :smswire`, loaded when - Noticed is present. -- Webhook endpoints accept both status and inbound events, for providers that - post everything to one URL. - -- Messenger previews at `/previews` with a phone frame, encoding, - segment count, remaining characters, and the characters that force UCS-2. -- Development inbox at `/inbox` listing deliveries and inbound - messages, with a form that simulates replies through keyword handling. -- Generators: `smswire:install`, `smswire:messenger`, and `smswire:provider`. -- `Smswire::Interceptors::Allowlist` for staging, suppressing or redirecting - messages to unlisted numbers. - -- `Smswire::Consent` with per-sender consent scopes, evidence metadata, and - `opt_in!`, `opt_out!`, `opt_out_everywhere!`, and `status_for`. -- Inbound webhook endpoint storing `Smswire::InboundMessage` once per - provider message id, with STOP / START / HELP keyword handling, - configurable auto-replies, and an `sms_received` observer hook. -- Category rules for consent, quiet hours, and rate limits, merged over - shipped defaults. New outcomes `:rejected_opted_out`, - `:rejected_no_consent`, `:rejected_rate_limited`, `:deferred_quiet_hours`, - and `:deferred_rate_limited`; deferred messages re-enqueue themselves. -- Carrier opt-out errors record an opt-out with source `carrier`. - -- `Smswire::Engine` with `smswire:install:migrations` and the - `smswire_deliveries` table, following the app's primary key type. -- `Smswire::Delivery` records for every send, with atomic send claims, - forward-only status, and retries that reuse their row. -- Deduplication of identical messages inside `dedupe_window`, returning - `:duplicate`, with optional explicit `idempotency_key`. -- Status callback endpoint with Twilio signature verification and - `sms_status_updated` observer hook. `callbacks_url` builds callback URLs. -- Per-category body storage, with `otp` bodies not stored by default. -- `Smswire::LogSubscriber` logging deliveries, rejections, and status - updates with masked numbers and no bodies. +## [0.1.0] - 2026-10-15 + +First functional release. Requires Ruby 3.2+ and Rails 7.1 to 8.1. + +### Messengers and delivery - `Smswire::Base` messenger classes with `default`, `with(params)`, `.text.erb` - templates, layouts, I18n lazy lookup, and URL helpers. -- `Smswire::Message` with GSM-7 / UCS-2 encoding detection and segment counting. -- Delivery pipeline: E.164 normalization, empty-body rejection, interceptors, - provider delivery, observers, and `ActiveSupport::Notifications` events. -- Providers: `twilio`, `log`, `test`, `null`, plus a registry for custom adapters. -- `deliver_now` returning `Smswire::Result`, and `deliver_later` through - `Smswire::DeliveryJob` with transient retries and Retry-After handling. -- Named senders, recipient resolution, and optional `phonelib` support. + templates, layouts, I18n lazy lookup, URL helpers, and named senders. +- `Smswire::Message` with GSM-7 / UCS-2 detection and segment counting. +- A delivery pipeline with E.164 normalization, consent checks, quiet hours, + rate limits, deduplication, interceptors, and observers, returning a + `Smswire::Result` with a typed status. +- `deliver_later` through `Smswire::DeliveryJob`, retrying transient errors + with backoff and honoring `Retry-After`. + +### Providers + +- Twilio, Telnyx, and Vonage adapters over REST with no provider SDK, plus + `log`, `test`, and `null` providers and a registry for custom adapters. +- Webhook signature verification for each provider: Twilio HMAC-SHA1, Telnyx + Ed25519, and Vonage `md5hash` or HMAC. +- `Smswire::ProviderContract`, a Minitest suite every adapter passes. +- `Smswire.verify_credentials!` for boot checks and health endpoints. + +### Persistence and tracking + +- `Smswire::Engine` with `smswire:install:migrations` and tables for + deliveries, consents, and inbound messages, following the app's primary + key type. +- A `Smswire::Delivery` row for every send, with atomic send claims, retries + that reuse their row, and forward-only status from provider callbacks. + +### Consent and compliance + +- `Smswire::Consent` with per-sender scopes and evidence metadata. +- STOP / START / HELP keyword handling with replies following CTIA guidance, + including a `support_contact` in HELP replies. +- Category rules: `marketing` requires opt-in and observes 9pm to 8am quiet + hours in the recipient's time zone. Carrier opt-out errors record opt-outs. + +### Developer experience + +- Previews at `/previews` and a development inbox at `/inbox`. +- Generators: `smswire:install`, `smswire:messenger`, and `smswire:provider`. - `Smswire::TestHelper` for Minitest and RSpec matchers in `smswire/rspec`. -- CI matrix over Ruby 3.2 to 3.4 and Rails 7.1 to 8.1. +- `Smswire::Interceptors::Allowlist` for staging. +- `Noticed::DeliveryMethods::Smswire` for `deliver_by :smswire`. +- Guides in `docs/guides`. + +### Known limitations + +- Free-text opt-outs such as "please stop texting me" are stored but not + acted on; the compliance guide shows how to review them. +- Concurrent sends can briefly exceed a rate limit. +- Vonage receipts for the second and later parts of a long message are not + matched to the delivery, and Vonage has no MMS. +- Telnyx ignores `validity_period`. + +## [0.0.1.pre] - 2026-10-08 -## [0.0.1.pre] +- Reserve the gem name. No functionality. -- Reserve the gem name. No functionality yet; see `docs/SPEC.md`. +[Unreleased]: https://github.com/timimsms/smswire/compare/v0.1.0...HEAD +[0.1.0]: https://github.com/timimsms/smswire/compare/v0.0.1.pre...v0.1.0 +[0.0.1.pre]: https://github.com/timimsms/smswire/releases/tag/v0.0.1.pre diff --git a/README.md b/README.md index 73bd158..0cf7e9a 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,8 @@ consent and STOP / HELP / START handling, quiet hours, previews, and a [Noticed](https://github.com/excid3/noticed) delivery method are included. See the [specification](docs/SPEC.md) for the full design. -**Status:** pre-release. All six phases of the spec are implemented; the -published `0.0.1.pre` gem only reserves the name. See -[RELEASING.md](RELEASING.md) for the release steps. +**Status:** `0.1.0`, the first functional release. The API may still change +before 1.0; breaking changes are called out in the [changelog](CHANGELOG.md). ## Guides diff --git a/RELEASING.md b/RELEASING.md index d307ee1..ae15dbb 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -17,29 +17,31 @@ manual pushes. ## Before 1.0 -- Merge the phase pull requests in order, so `main` holds the release. - Confirm open decisions 4 to 6 in `docs/SPEC.md`. -- Review the known limitations listed under Phase 6 in `docs/SPEC.md`. +- Review the known limitations in `CHANGELOG.md` and `docs/SPEC.md`. - Try the getting-started guide in a new Rails app against a real provider account, including a STOP reply and a delivery status callback. ## Each release -1. Make sure CI is green on `main`. -2. Update `lib/smswire/version.rb`. -3. In `CHANGELOG.md`, rename `[Unreleased]` to the version and the release - date, and start a new empty `[Unreleased]` section. -4. Commit: `Release vX.Y.Z`. -5. Tag and push: +1. Open a pull request that: + - updates `lib/smswire/version.rb`; + - in `CHANGELOG.md`, moves the `[Unreleased]` entries under a new + `[X.Y.Z] - YYYY-MM-DD` heading, leaves `[Unreleased]` empty, and updates + the compare links at the bottom. +2. Merge it once CI is green. +3. In GitHub, open **Actions > Release > Run workflow** on `main`. +4. The workflow runs the tests, then `rake release` builds the gem, creates + and pushes the `vX.Y.Z` tag, and publishes with trusted publishing. It + waits until the version is available on RubyGems. +5. Create a GitHub release from the new tag with the changelog section: ``` - git tag -a vX.Y.Z -m "vX.Y.Z" - git push origin main vX.Y.Z + gh release create vX.Y.Z --notes-file <(sed -n '/^## \[X.Y.Z\]/,/^## \[/p' CHANGELOG.md | sed '$d') ``` -6. The release workflow runs the tests, builds the gem, and pushes it to - RubyGems. Check https://rubygems.org/gems/smswire afterwards. -7. Create a GitHub release from the tag with the changelog section. +If the workflow fails before publishing, fix the problem and run it again; +`rake release` skips tagging when the tag already exists. ## If a release goes wrong diff --git a/lib/smswire/version.rb b/lib/smswire/version.rb index 331fc47..916872c 100644 --- a/lib/smswire/version.rb +++ b/lib/smswire/version.rb @@ -1,3 +1,3 @@ module Smswire - VERSION = "0.0.1.pre" + VERSION = "0.1.0" end