Merge pull request #1394 from useautumn/charlie/gh-action-improvements
Charlie/gh action improvements
This commit is contained in:
24
.github/workflows/server-typecheck.yml
vendored
24
.github/workflows/server-typecheck.yml
vendored
@@ -3,9 +3,33 @@ name: Server Type Check
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check changed files
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
server: ${{ steps.filter.outputs.server }}
|
||||
steps:
|
||||
- name: Check changed files
|
||||
id: filter
|
||||
uses: dorny/paths-filter@6852f92c20ea7fd3b0c25de3b5112db3a98da050
|
||||
with:
|
||||
filters: |
|
||||
server:
|
||||
- "server/**"
|
||||
- "shared/**"
|
||||
- "package.json"
|
||||
- "bun.lock"
|
||||
- ".github/workflows/server-typecheck.yml"
|
||||
|
||||
typecheck:
|
||||
name: Type Check
|
||||
needs: changes
|
||||
if: needs.changes.outputs.server == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
24
.github/workflows/server-unit-tests.yml
vendored
24
.github/workflows/server-unit-tests.yml
vendored
@@ -5,9 +5,33 @@ on:
|
||||
paths:
|
||||
- "server/**"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check changed files
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
server: ${{ steps.filter.outputs.server }}
|
||||
steps:
|
||||
- name: Check changed files
|
||||
id: filter
|
||||
uses: dorny/paths-filter@6852f92c20ea7fd3b0c25de3b5112db3a98da050
|
||||
with:
|
||||
filters: |
|
||||
server:
|
||||
- "server/**"
|
||||
- "shared/**"
|
||||
- "package.json"
|
||||
- "bun.lock"
|
||||
- ".github/workflows/server-unit-tests.yml"
|
||||
|
||||
unit-tests:
|
||||
name: Unit Tests
|
||||
needs: changes
|
||||
if: needs.changes.outputs.server == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
28
.github/workflows/vite-build.yml
vendored
28
.github/workflows/vite-build.yml
vendored
@@ -3,9 +3,35 @@ name: Vite Build Check
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check changed files
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
vite: ${{ steps.filter.outputs.vite }}
|
||||
steps:
|
||||
- name: Check changed files
|
||||
id: filter
|
||||
uses: dorny/paths-filter@6852f92c20ea7fd3b0c25de3b5112db3a98da050
|
||||
with:
|
||||
filters: |
|
||||
vite:
|
||||
- "vite/**"
|
||||
- "shared/**"
|
||||
- "packages/atmn/**"
|
||||
- "packages/autumn-js/**"
|
||||
- "package.json"
|
||||
- "bun.lock"
|
||||
- ".github/workflows/vite-build.yml"
|
||||
|
||||
typecheck:
|
||||
name: Type Check
|
||||
needs: changes
|
||||
if: needs.changes.outputs.vite == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -25,6 +51,8 @@ jobs:
|
||||
|
||||
build:
|
||||
name: Build
|
||||
needs: changes
|
||||
if: needs.changes.outputs.vite == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
26
.github/workflows/vite-unit-tests.yml
vendored
26
.github/workflows/vite-unit-tests.yml
vendored
@@ -5,9 +5,35 @@ on:
|
||||
paths:
|
||||
- "vite/**"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check changed files
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
vite: ${{ steps.filter.outputs.vite }}
|
||||
steps:
|
||||
- name: Check changed files
|
||||
id: filter
|
||||
uses: dorny/paths-filter@6852f92c20ea7fd3b0c25de3b5112db3a98da050
|
||||
with:
|
||||
filters: |
|
||||
vite:
|
||||
- "vite/**"
|
||||
- "shared/**"
|
||||
- "packages/atmn/**"
|
||||
- "packages/autumn-js/**"
|
||||
- "package.json"
|
||||
- "bun.lock"
|
||||
- ".github/workflows/vite-unit-tests.yml"
|
||||
|
||||
unit-tests:
|
||||
name: Unit Tests
|
||||
needs: changes
|
||||
if: needs.changes.outputs.vite == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
@@ -8,7 +8,7 @@ import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
|
||||
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";
|
||||
|
||||
<Note>
|
||||
The update endpoint modifies an existing subscription. Use this to change prepaid quantities, cancel subscriptions, or modify plan configuration. For subscribing to a new plan, use [attach](/api-reference/billing/billingAttach) instead.
|
||||
The update endpoint modifies an existing subscription. Use this to change prepaid quantities, cancel subscriptions, or modify plan configuration. For subscribing to a new plan, use [attach](/api-reference/billing/attach) instead.
|
||||
</Note>
|
||||
|
||||
### Common Use Cases
|
||||
|
||||
@@ -7,7 +7,7 @@ import { DynamicParamField } from "/components/dynamic-param-field.jsx";
|
||||
import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
|
||||
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";
|
||||
|
||||
Creates a new plan with optional base price and feature configurations. See [How plans work](/documentation/pricing/plans) for concepts and [Adding features to plans](/documentation/pricing/plan-features) for item configuration.
|
||||
Creates a new plan with optional base price and feature configurations. See [How plans work](/documentation/concepts/plans) for concepts and [Adding features to plans](/documentation/concepts/plan-items) for item configuration.
|
||||
|
||||
### Plan Configuration
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { DynamicParamField } from "/components/dynamic-param-field.jsx";
|
||||
import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
|
||||
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";
|
||||
|
||||
Updates an existing plan. By default, creates a new version of the plan. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration.
|
||||
Updates an existing plan. By default, creates a new version of the plan. See [Adding features to plans](/documentation/concepts/plan-items) for item configuration.
|
||||
|
||||
<Note>
|
||||
Updates create a new plan version by default. Existing customers remain on their current version until their subscription renews or they explicitly upgrade.
|
||||
|
||||
@@ -61,7 +61,7 @@ You'll be prompted to choose a starter template:
|
||||
| **Linear** | Per-seat pricing with team limits |
|
||||
| **OpenAI** | Credit system mapping multiple AI models |
|
||||
|
||||
Pick whichever is closest to your use case, or start from scratch and build your own using the [config reference](/api-reference/cli/config).
|
||||
Pick whichever is closest to your use case, or start from scratch and build your own using the [config reference](/cli/config).
|
||||
|
||||
## Push and pull
|
||||
|
||||
@@ -115,7 +115,7 @@ Learn how to define features, plans, and pricing in your `autumn.config.ts`.
|
||||
|
||||
<Card
|
||||
title="Configuration reference"
|
||||
href="/api-reference/cli/config"
|
||||
href="/cli/config"
|
||||
>
|
||||
Complete reference for features, plans, and plan features
|
||||
</Card>
|
||||
|
||||
@@ -12,7 +12,7 @@ flowchart LR
|
||||
S -->|provisions| B[Balances]
|
||||
```
|
||||
|
||||
When a subscription is created, Autumn provisions [balances](/documentation/customers/balances) for each feature in the plan. Balances determine what the customer can access and track how much they've used. For example, a Pro plan might grant 1,000 API requests per month—this becomes a balance that decrements as the customer uses your product.
|
||||
When a subscription is created, Autumn provisions [balances](/documentation/concepts/balances) for each feature in the plan. Balances determine what the customer can access and track how much they've used. For example, a Pro plan might grant 1,000 API requests per month—this becomes a balance that decrements as the customer uses your product.
|
||||
|
||||
Balances can also be created for [credit systems](/documentation/modelling-pricing/credit-systems) (eg, $10 credits per month) and boolean toggle features (eg, access to a premium analytics dashboard).
|
||||
|
||||
@@ -27,10 +27,10 @@ Balances can also be created for [credit systems](/documentation/modelling-prici
|
||||
| `expired` | Subscription has ended |
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Accepting Payments" icon="credit-card" href="/documentation/subscriptions/accepting-payments">
|
||||
<Card title="Accepting Payments" icon="credit-card" href="/documentation/customers/payment-flow">
|
||||
Learn about the checkout and payment flow
|
||||
</Card>
|
||||
<Card title="Managing Subscriptions" icon="sliders" href="/documentation/subscriptions/managing-subscriptions">
|
||||
<Card title="Managing Subscriptions" icon="sliders" href="/documentation/customers/subscription-lifecycle">
|
||||
Handle upgrades, downgrades and cancellations
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -10,7 +10,7 @@ Entities are sub accounts of a customer. For example, you may have a product tha
|
||||
There are two ways you can handle entities depending on your use case.
|
||||
|
||||
1. **Entity-level balances**: this is the simplest way of handling entities, and keeps everything under 1 subscription. This is useful when all entities get the same features and limits.
|
||||
2. **Entity-level subscriptions**: if an entity can have its own subscription tiers (ie basic seats, pro seats), then you can attach a product directly at the entity level by passing the [entity ID](/api-reference/billing/billingAttach#body-entity-id) into an attach function. Each will be under its own subscription in Stripe with the billing cycles synced.
|
||||
2. **Entity-level subscriptions**: if an entity can have its own subscription tiers (ie basic seats, pro seats), then you can attach a product directly at the entity level by passing the [entity ID](/api-reference/billing/attach#body-entity-id) into an attach function. Each will be under its own subscription in Stripe with the billing cycles synced.
|
||||
|
||||
<Info>
|
||||
**Example**
|
||||
|
||||
@@ -76,7 +76,7 @@ curl -X POST https://api.useautumn.com/v1/balances/create \
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
See the [Create Balance API reference](/api-reference/features/create-balance) for all available parameters.
|
||||
See the [Create Balance API reference](/api-reference/balances/createBalance) for all available parameters.
|
||||
|
||||
## Updating Balances (API)
|
||||
|
||||
@@ -116,7 +116,7 @@ curl -X POST https://api.useautumn.com/v1/customers/user_123/balances \
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
See the [Set Feature Balance API reference](/api-reference/features/set-feature-balances) for all available parameters.
|
||||
See the [Set Feature Balance API reference](/api-reference/balances/updateBalance) for all available parameters.
|
||||
|
||||
## Querying Balances
|
||||
|
||||
|
||||
@@ -196,4 +196,4 @@ The `billing.attach` response has two key fields:
|
||||
|
||||
**`payment_url`** — a URL the customer should be redirected to, or `null` if no redirect is needed.
|
||||
|
||||
**`required_action`** — present when payment couldn't be processed automatically. See [Edge Cases](/documentation/customers/billing/edge-cases) for details on handling 3DS, payment failures, and retries.
|
||||
**`required_action`** — present when payment couldn't be processed automatically. See [Edge Cases](/documentation/customers/edge-cases) for details on handling 3DS, payment failures, and retries.
|
||||
|
||||
@@ -168,7 +168,7 @@ By default, updating a subscription with billing changes will generate an invoic
|
||||
|
||||
### Previewing changes before executing
|
||||
|
||||
Similar to [`billing.previewAttach`](/documentation/customers/attaching-plans#step-1-preview-the-change), you can use `billing.previewUpdate` to see exactly what will be charged before making changes. This returns line items and totals that you can display in a confirmation UI.
|
||||
Similar to [`billing.previewAttach`](/documentation/customers/payment-flow#step-1-preview-the-charge), you can use `billing.previewUpdate` to see exactly what will be charged before making changes. This returns line items and totals that you can display in a confirmation UI.
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ const { data } = await autumn.checkout({
|
||||
|
||||
## Cancelling add-ons
|
||||
|
||||
Cancel an add-on using the same [cancel](/documentation/customers/managing-subscriptions#cancellations) flow:
|
||||
Cancel an add-on using the same [cancel](/documentation/customers/subscription-lifecycle#cancellations) flow:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ Push changes with `atmn push`.
|
||||
|
||||
## Attaching a subscription
|
||||
|
||||
Use [billing.attach](/documentation/customers/attaching-plans) to attach a subscription to a customer. With `redirectMode: "always"`, a checkout URL is always returned for the customer to complete payment or confirm the plan change.
|
||||
Use [billing.attach](/documentation/customers/payment-flow) to attach a subscription to a customer. With `redirectMode: "always"`, a checkout URL is always returned for the customer to complete payment or confirm the plan change.
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
@@ -212,7 +212,7 @@ This is useful when you want to offer an annual discount while still metering us
|
||||
|
||||
## Managing subscriptions
|
||||
|
||||
Once a customer has an active subscription, you can manage upgrades, downgrades, and cancellations. See [Managing Subscriptions](/documentation/customers/s) for details on:
|
||||
Once a customer has an active subscription, you can manage upgrades, downgrades, and cancellations. See [Managing Subscriptions](/documentation/customers/subscription-lifecycle) for details on:
|
||||
|
||||
- **Upgrades** — prorated charges for switching to a higher-priced plan
|
||||
- **Downgrades** — scheduled at end of billing period
|
||||
|
||||
@@ -198,7 +198,7 @@ curl -X POST "https://api.useautumn.com/v1/check" \
|
||||
|
||||
## Upgrading an entity's plan
|
||||
|
||||
To upgrade or downgrade an entity, attach the new plan with the same `entity_id`. The same [upgrade/downgrade](/documentation/customers/billing/subscription-lifecycle) logic applies:
|
||||
To upgrade or downgrade an entity, attach the new plan with the same `entity_id`. The same [upgrade/downgrade](/documentation/customers/subscription-lifecycle) logic applies:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
@@ -233,7 +233,7 @@ curl -X POST "https://api.useautumn.com/v1/billing.attach" \
|
||||
|
||||
## Cancelling an entity's plan
|
||||
|
||||
Use `billing.update` with `cancelAction` to cancel an entity's plan. The same [cancel/uncancel](/documentation/customers/billing/subscription-lifecycle#cancellations) behavior applies.
|
||||
Use `billing.update` with `cancelAction` to cancel an entity's plan. The same [cancel/uncancel](/documentation/customers/subscription-lifecycle#cancellations) behavior applies.
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ export default function UpgradeButton() {
|
||||
Open checkout URL in a new tab instead of redirecting.
|
||||
</ParamField>
|
||||
|
||||
See the [API reference](/api-reference/billing/billingAttach) for all available parameters.
|
||||
See the [API reference](/api-reference/billing/attach) for all available parameters.
|
||||
|
||||
### `check()`
|
||||
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
---
|
||||
title: Understanding how Autumn works
|
||||
sidebarTitle: Understand Autumn
|
||||
description: "Autumn is built to manage your feature access and your billing together. Learn how it all works."
|
||||
---
|
||||
|
||||
## The Autumn flow
|
||||
|
||||
The typical Autumn flow looks like this:
|
||||
|
||||
<Steps>
|
||||
<Step title="Define your pricing model in the Autumn dashboard">
|
||||
The dashboard is where you define which of your users get access to what, and how much they're charged for it. Here, you'll [create products](/products/create-product) and [manage your customers](/customers/managing-customers).
|
||||
</Step>
|
||||
<Step title="Call attach when a customer wants to purchase a product">
|
||||
From your application, when your customer wants to [purchase](/products/enabling-product) one of your price plans, the `attach` endpoint will return a Stripe checkout URL.
|
||||
|
||||
Once they've purchased, Autumn grants access to the product's features that were defined in the dashboard.
|
||||
|
||||
If the customer is already paying for a plan, this will automatically handle any [upgrades and downgrades](products/enabling-product#upgrades-and-downgrades) too.
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Check whether a customer has access to something">
|
||||
From your application, you can [check](/features/check) in real-time whether a customer has access to:
|
||||
|
||||
- a product (eg, pro tier)
|
||||
- a feature balance (eg, 10 remaining credits)
|
||||
- a feature flag (eg, premium AI models)
|
||||
|
||||
Autumn will return whether they're `allowed` access, and you can use this to control access to your features. When you want to update your pricing model, you can do so without changing any of your code.
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Track usage for usage-based features">
|
||||
For your usage-based features, if Autumn tells you they're `allowed` access, you can [track their usage](/features/tracking-usage) to update their balance.
|
||||
|
||||
This means Autumn can enforce any usage limits you set (ie, by returning `allowed: false` once they hit a balance of 0). It also allows you to charge for usage (eg, $1 per AI tokens used), if you have a usage-based pricing model.
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Display customer's information and balances">
|
||||
When using usage-based features, you'll typically want to [display the customer's balance](/api-reference/customers/get) to them. You can do this from the `customers` route or hook, which will return customer information, the product they've purchased, and the balance of any usage-based features.
|
||||
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
This means all of the logic that you would typically have to build yourself is done for you.
|
||||
|
||||
- How do I limit usage of this feature to 10 per month, then reset?
|
||||
- How would I bill users who go over the limit?
|
||||
- How do I build in-app flows for upgrading, downgrading, cancelling?
|
||||
- What if I want add-ons, or credits?
|
||||
- My billing is at the org level. How do I track feature limits at the user level?
|
||||
- What happens to their usage if they upgrade, or downgrade, or cancel?
|
||||
- How can I block access if payment fails?
|
||||
- How would I migrate people if I change my pricing?
|
||||
- What should I do if I want a custom plan for different customers?
|
||||
|
||||
Autumn takes care of all of this, and more.
|
||||
|
||||
## Why use Autumn?
|
||||
|
||||
Autumn is loved by developers, founders and fast-growing startups because it's easy to integrate and **billing never has to be touched again**.
|
||||
|
||||
1. **The simplest integration you'll find** - Just 2 API calls to set up any pricing model. You don't need to deal with webhooks, state syncing, or deal with any of Stripe's APIs.
|
||||
2. **Enforce access limits** - Autumn knows who's paying for which product and what features they have access to. Just [check](/features/check.mdx) if a customer has access, then [track](/features/tracking-usage.mdx) any usage if needed.
|
||||
3. **Billing flows handled** - Upgrades, downgrades, failed payments, and more. Autumn takes care of it all, with customizable UI components that "just work" out of the box.
|
||||
4. **Make changes without touching code** - Make pricing changes, set custom plans, or launch new types of pricing without going through engineering. Versioning, grandfathering and migrations is easy through the Autumn dashboard.
|
||||
|
||||
## What Autumn isn't
|
||||
|
||||
- A Stripe billing replacement: although you don't need to deal with Stripe's APIs, you are still using Stripe's subscriptions, payments and invoicing.
|
||||
- Another metered billing product: Autumn easily handles usage-based billing up to 100 events per second, but there are many providers out there that specialize if you need more.
|
||||
- For purely sales-led companies: Autumn is designed to be used by product-led, or hybrid product-sales teams. If your customers only pay via custom invoices, Autumn is probably not for you.
|
||||
|
||||
Now that you understand how Autumn works, check out one of the quickstart guides to get started!
|
||||
@@ -81,7 +81,8 @@ export const useHasChanges = () => {
|
||||
const hasChanges =
|
||||
!comparison.itemsSame ||
|
||||
!comparison.detailsSame ||
|
||||
!comparison.freeTrialsSame;
|
||||
!comparison.freeTrialsSame ||
|
||||
!comparison.configSame;
|
||||
|
||||
return hasChanges;
|
||||
}, [product, baseProduct, features]);
|
||||
|
||||
Reference in New Issue
Block a user