Skip to content

Commit 23de905

Browse files
authored
e2e-versions: Add plugin-directory input for plugins in subdirectories (#75)
* e2e-versions: Add plugin-directory input for plugins in subdirectories * Update README
1 parent ff169fa commit 23de905

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

e2e-version/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ By default, this actions resolves an image for the latest build of the main bran
1212

1313
The maximum number of versions to resolve. Default is 6, 0 means no limit.
1414

15+
### `plugin-directory`
16+
17+
The directory where `plugin.json` is located. It defaults to `src`, which works for monorepos where the plugin is in the root of the repository.
18+
1519
### `version-resolver-type`
1620

1721
The action supports two modes.
1822

1923
**plugin-grafana-dependency (default)**
20-
The will return the most recent grafana-dev image and all the latest patch release of every minor version of Grafana Enterprise that satisfies the range specified in the [dependencies.grafanaDependency](https://grafana.com/developers/plugin-tools/reference/plugin-json#properties-1) property in plugin.json. This requires the plugin.json file to be placed in the `<root>/src` directory. To avoid starting too many jobs, to output will be capped 6 versions.
24+
The will return the most recent grafana-dev image and all the latest patch release of every minor version of Grafana Enterprise that satisfies the range specified in the [dependencies.grafanaDependency](https://grafana.com/developers/plugin-tools/reference/plugin-json#properties-1) property in plugin.json. To avoid starting too many jobs, to output will be capped 6 versions.
2125

2226
### Example
2327

e2e-version/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ inputs:
2626
required: false
2727
description: 'The maximum number of versions to resolve. Default is 6, 0 means no limit.'
2828
default: "6"
29+
plugin-directory:
30+
required: false
31+
description: 'The directory where the plugin.json file is located. Default is `src`.'
32+
default: src
2933

3034
output:
3135
matrix:

e2e-version/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const SkipGrafanaDevImageInput = 'skip-grafana-dev-image';
88
const VersionResolverTypeInput = 'version-resolver-type';
99
const GrafanaDependencyInput = 'grafana-dependency';
1010
const LimitInput = 'limit';
11+
const PluginDirectoryInput = 'plugin-directory';
1112
const MatrixOutput = 'matrix';
1213

1314
const VersionResolverTypes = {
@@ -137,7 +138,7 @@ async function getGrafanaStableMinorVersions() {
137138
}
138139

139140
async function getPluginGrafanaDependencyFromPluginJson() {
140-
const file = await fs.readFile(path.resolve(path.join(process.cwd(), 'src'), 'plugin.json'), 'utf8');
141+
const file = await fs.readFile(path.resolve(path.join(core.getInput(PluginDirectoryInput)), 'plugin.json'), 'utf8');
141142
const json = JSON.parse(file);
142143
if (!json.dependencies.grafanaDependency) {
143144
throw new Error('Could not find plugin grafanaDependency');

0 commit comments

Comments
 (0)