Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
36 changes: 36 additions & 0 deletions .github/actions/app-inventory/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
name: App Inventory
description: Return items from the apps directory in a JSON array

outputs:
apps:
description: App Inventory
value: ${{ steps.inventory.outputs.apps }}

runs:
using: composite
steps:
- name: App Inventory
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: inventory
with:
script: |
const fs = require('fs');
const path = require('path');

function scanDirectory(dirPath) {
try {
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
const folderNames = entries
.filter((entry) => entry.isDirectory())
.map((entry) => entry.name);
return folderNames;
} catch (error) {
console.error(`Error reading directory ${dirPath}:`, error.message);
return [];
}
}

const apps = scanDirectory(path.resolve(__dirname, 'apps')).sort();
core.setOutput('apps', JSON.stringify(apps));
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
name: Definitive Versions
description: Takes a version string and returns the definitive versions
name: App Versions
description: Takes an upstream version string and returns the sanitized versions

inputs:
version:
description: Version
upstream-version:
description: Upstream Version
required: true

outputs:
Expand All @@ -18,6 +18,9 @@ outputs:
raw:
description: Raw Version
value: ${{ steps.version.outputs.raw }}
upstream:
description: Upstream Version
value: ${{ steps.version.outputs.upstream }}

runs:
using: composite
Expand All @@ -31,7 +34,7 @@ runs:
shell: bash
run: npm install semver

- name: Determine Definitive Version
- name: Determine App Versions
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: version
with:
Expand All @@ -48,15 +51,16 @@ runs:
return `${now.getFullYear()}.${now.getMonth() + 1}.${now.getDate()}`;
}

const version = '${{ inputs.version }}';
const upstreamVersion = '${{ inputs.upstream-version }}';
const strictSemverRegex = /^v?(\d+(\.\d+)?(\.\d+)?)/;

const parsedVersion = strictSemverRegex.exec(version);
const parsedVersion = strictSemverRegex.exec(upstreamVersion);
const isValidSemver = parsedVersion !== null;
const parsedSemver = isValidSemver ? semver.coerce(parsedVersion[0]) : null;
const semanticVersion = isValidSemver ? `${parsedSemver.major}.${parsedSemver.minor}.${parsedSemver.patch}` : calver();
const rawVersion = isValidSemver ? sanitize(version) : version;
const rawVersion = isValidSemver ? sanitize(upstreamVersion) : upstreamVersion;

core.setOutput('is-valid-semver', isValidSemver);
core.setOutput('semantic', semanticVersion);
core.setOutput('raw', rawVersion);
core.setOutput('upstream', upstreamVersion);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
name: Test Container
description: Takes an app and container image and runs tests
name: Container Tests
description: Takes an app and container image and runs container tests

inputs:
app:
Expand Down
Loading