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
42 changes: 20 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
name: Release to NPM
run-name: Release @metabase/representations v${{ inputs.version }} (${{ inputs.npm_tag }})

on:
push:
branches: [main]
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g. 1.0.0)"
type: string
required: true
npm_tag:
description: "NPM dist-tag"
type: choice
required: true
default: "latest"
options:
- latest
- next
- canary

jobs:
publish:
Expand All @@ -32,20 +19,31 @@ jobs:
node-version: "20"
registry-url: "https://registry.npmjs.org"

- name: Set package version
run: npm version ${{ inputs.version }} --no-git-tag-version
- name: Compare local and published versions
id: check
run: |
LOCAL=$(node -p "require('./package.json').version")
PUBLISHED=$(npm view @metabase/representations version 2>/dev/null || echo "none")
echo "local=$LOCAL" >> $GITHUB_OUTPUT
echo "published=$PUBLISHED" >> $GITHUB_OUTPUT
if [ "$LOCAL" != "$PUBLISHED" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi

- name: Publish to NPM
run: npm publish --tag ${{ inputs.npm_tag }}
if: steps.check.outputs.changed == 'true'
run: npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }}

- name: Generate workflow summary
run: |
tee -a $GITHUB_STEP_SUMMARY << EOF
## Published @metabase/representations
## @metabase/representations

- **Version**: ${{ inputs.version }}
- **Tag**: ${{ inputs.npm_tag }}
- **Triggered by**: @${{ github.event.sender.login }}
- **Local version**: ${{ steps.check.outputs.local }}
- **Published version**: ${{ steps.check.outputs.published }}
- **Published this run**: ${{ steps.check.outputs.changed }}
EOF
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ for (const result of results) {

## Publishing to NPM

Releases are published via the **Release to NPM** GitHub Actions workflow.
Releases are published automatically by the **Release to NPM** GitHub Actions workflow on every push to `main`. The workflow compares the `version` in `package.json` against the version published on npm and publishes (with the `latest` dist-tag) if they differ.

1. Go to **Actions > Release to NPM > Run workflow**.
2. Enter the version (e.g. `1.1.0`) and pick a dist-tag (`latest`, `next`, or `canary`).
3. Click **Run workflow**.
To cut a release, bump `version` in `package.json` and merge to `main`.

The workflow requires an `NPM_RELEASE_TOKEN` secret with publish access to the `@metabase` npm org.
3 changes: 3 additions & 0 deletions core-spec/v1/schemas/collection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ properties:
enum:
- null
- instance-analytics
- library
- library-data
- library-metrics

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we extend it to include shared-tenant-collection and tenant-specific-root-collection?

namespace:
type:
- string
Expand Down
9 changes: 4 additions & 5 deletions core-spec/v1/schemas/transform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ properties:
$ref: "common/id.yaml#/$defs/database_id"
type:
type: string
const: table
enum:
- table
- table-incremental
schema:
type:
- string
Expand Down Expand Up @@ -173,10 +175,7 @@ $defs:
type: string
description: Table name
table_id:
type:
- integer
- "null"
description: Metabase table ID
$ref: "common/id.yaml#/$defs/table_id"
source-database:
$ref: "common/id.yaml#/$defs/database_id"
source-incremental-strategy:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metabase/representations",
"version": "1.1.2",
"version": "1.1.3",
"description": "Metabase representation format specification and schema validator",
"license": "SEE LICENSE IN LICENSE.txt",
"repository": {
Expand Down
Loading