Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,12 @@ jobs:
release:
runs-on: ubuntu-latest
needs: [test, generate-plugins]
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci') && github.actor != 'dependabot[bot]'"
if: |
!contains(github.event.head_commit.message, 'ci skip')
&& !contains(github.event.head_commit.message, 'skip ci')
&& github.actor != 'dependabot[bot]'
&& github.event_name == 'push'
&& github.ref == 'refs/heads/main'
name: Release packages
env:
NX_BRANCH: ${{ github.event.number || github.ref_name }}
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Preview (pkg.pr.new)
on:
pull_request:
types: [labeled, synchronize]
permissions:
contents: read
Comment thread
jackw marked this conversation as resolved.
concurrency:
group: preview-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
preview:
if: |
(github.event.action == 'labeled' && github.event.label.name == 'preview') ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'preview'))
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# We need to fetch all branches and commits so that Nx affected has a base to compare against.
fetch-depth: 0
persist-credentials: false
- uses: nrwl/nx-set-shas@afb73a62d26e41464e9254689e1fd6122ee683c1 # v5.0.1
- name: Setup nodejs
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: '.nvmrc'
package-manager-cache: false

- name: Install dependencies
run: npm ci --no-audit
- name: Build all packages
run: npm run build
- name: Publish packages
run: npm exec pkg-pr-new publish -- './packages/*' --compact --commentWithSha --commentWithDev
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Contribute Documentation](#contribute-documentation)
- [Contribute Code](#contribute-code)
- Manage Something ✅🙆🏼💃👔
- [Preview Your Changes Before Release](#preview-your-changes-before-release)
- [Create a Release](#create-a-release)
- [Release Version Calculation](#release-version-calculation)
- [Help! The release failed after the packages were published to the NPM registry](#help-the-release-failed-after-the-packages-were-published-to-the-npm-registry)
Expand Down Expand Up @@ -160,6 +161,33 @@ Once you've filed the PR:
- If the maintainer decides to pass on your PR, they will thank you for the contribution and explain why they won't be accepting the changes. That's okay! We still really appreciate you taking the time to do it, and we don't take that lightly. 💚
- If your PR gets accepted, it will be marked as such, and merged into the `main` branch soon after. Your contribution will be distributed to the masses next time the maintainers [create a release](#create-a-release)

## Preview Your Changes Before Release

Whilst developing new features it's possible to publish and install preview builds of every affected package using [pkg.pr.new](https://pkg.pr.new) — a free open-source service that builds and hosts SHA-keyed npm tarballs.

To opt in:

1. Add the `preview` label to your PR.
2. CI builds every workspace and publishes the affected packages to pkg.pr.new.
3. The [`pkg-pr-new[bot]`](https://github.com/apps/pkg-pr-new) posts a comment on the PR with one installable URL per affected package.

Consumers install the preview by URL:

```bash
npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/<package-name>@<commit-sha>
```

For CLI packages (`create-plugin`, `plugin-docs-cli`, `plugin-meta-extractor`, `plugin-types-bundler`, `react-detect`, `sign-plugin`), you can also run the binary directly without installing:

```bash
npx https://pkg.pr.new/grafana/plugin-tools/@grafana/<cli-package>@<commit-sha>
```

> [!IMPORTANT]
> The URL keys off the commit SHA, not a real semver version. Any `package.json` reference to a pkg.pr.new URL must be swapped back to the published version once the PR is merged and released.

When you push new commits to a PR with the `preview` label, the existing pkg.pr.new comment is updated in place with the new commit SHA.

## Create A Release

Releases are managed by [Auto](https://intuit.github.io/auto/index) and PR labels.
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"husky": "^9.1.7",
"lerna": "^9.0.3",
"lint-staged": "^16.2.7",
"pkg-pr-new": "^0.0.75",
"prettier": "3.8.3",
"publint": "^0.3.12",
"rollup": "^4.57.1",
Expand Down
1 change: 1 addition & 0 deletions packages/create-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@grafana/create-plugin",
"version": "7.6.2",
"repository": {
"type": "git",
"directory": "packages/create-plugin",
"url": "https://github.com/grafana/plugin-tools"
},
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
],
"homepage": "https://www.npmjs.com/package/@grafana/eslint-plugin-plugins",
"repository": {
"type": "git",
"directory": "packages/eslint-plugin-plugins",
"url": "git+https://github.com/grafana/plugin-tools.git"
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-docs-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"CHANGELOG.md"
],
"repository": {
"type": "git",
"directory": "packages/plugin-docs-cli",
"url": "https://github.com/grafana/plugin-tools"
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-docs-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"CHANGELOG.md"
],
"repository": {
"type": "git",
"directory": "packages/plugin-docs-parser",
"url": "https://github.com/grafana/plugin-tools"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-e2e/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ Beware that scenarios provided by @grafana/plugin-e2e needs to be work in older

3. Push the changes in your local PR, create a draft PR in [grafana/plugin-tools](https://github.com/grafana/plugin-tools/) and add the labels `release` and `minor|patch`. CI will run all Playwright tests against a set of different Grafana versions. If not all of them pass, it may be because you've introduced a change that is no longer compatible with older versions of Grafana.

4. Once CI passes, `auto` will publish a canary release to NPM. You can find the version number at the bottom of the PR description.
4. Add the **`preview`** label to your PR. [pkg.pr.new](https://pkg.pr.new) will post a comment with an installable preview URL for `@grafana/plugin-e2e` (and any other affected packages). See [Preview Your Changes Before Release](../../CONTRIBUTING.md#preview-your-changes-before-release) in the root `CONTRIBUTING.md` for details.

5. Install the pre-release of @grafana/plugin-e2e in [grafana/grafana](https://github.com/grafana/grafana) and run Playwright tests.

```bash
# In your local grafana development folder
yarn add @grafana/plugin-e2e@0.3.0-canary.623.aedff75.0
yarn add https://pkg.pr.new/grafana/plugin-tools/@grafana/plugin-e2e@<commit-sha>
yarn e2e:plugin
```

Expand Down
1 change: 1 addition & 0 deletions packages/plugin-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"./package.json"
],
"repository": {
"type": "git",
"directory": "packages/plugin-e2e",
"url": "https://github.com/grafana/plugin-tools"
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-meta-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"provenance": true
},
"repository": {
"type": "git",
"directory": "packages/plugin-meta-extractor",
"url": "https://github.com/grafana/plugin-tools"
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-types-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"provenance": true
},
"repository": {
"type": "git",
"directory": "packages/plugin-types-bundler",
"url": "https://github.com/grafana/plugin-tools"
},
Expand Down
1 change: 1 addition & 0 deletions packages/react-detect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Run various checks to detect if a Grafana plugin is compatible with React.",
"version": "0.6.4",
"repository": {
"type": "git",
"directory": "packages/react-detect",
"url": "https://github.com/grafana/plugin-tools"
},
Expand Down
1 change: 1 addition & 0 deletions packages/sign-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@grafana/sign-plugin",
"version": "3.2.2",
"repository": {
"type": "git",
"directory": "packages/sign-plugin",
"url": "https://github.com/grafana/plugin-tools"
},
Expand Down
1 change: 1 addition & 0 deletions packages/tsconfig/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"config"
],
"repository": {
"type": "git",
"directory": "packages/tsconfig",
"url": "https://github.com/grafana/plugin-tools"
},
Expand Down
Loading