Skip to content

add plugin workspace to releases #3402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: v2
Choose a base branch
from
Draft
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
200 changes: 190 additions & 10 deletions packages/releases-generator/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,156 @@ const packages = [
url: 'https://raw.githubusercontent.com/tauri-apps/tao/dev/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/tao/releases/tag',
},
{
name: 'autostart',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/autostart/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'barcode-scanner',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/barcode-scanner/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'biometric',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/biometric/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'cli',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/cli/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'clipboard-manager',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/clipboard-manager/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'deep-link',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/deep-link/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'dialog',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/dialog/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'fs',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/fs/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'global-shortcut',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/global-shortcut/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'http',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/http/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'log',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/log/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'nfc',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/nfc/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'notification',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/notification/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'opener',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/opener/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'os',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/os/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'positioner',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/positioner/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'process',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/process/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'shell',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/shell/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'sql',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/sql/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'store',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/store/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'stronghold',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/stronghold/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'updater',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/updater/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'upload',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/upload/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'websocket',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/websocket/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
{
name: 'window-state',
url: 'https://raw.githubusercontent.com/tauri-apps/plugins-workspace/v2/plugins/window-state/CHANGELOG.md',
tag: 'https://github.com/tauri-apps/plugins-workspace/releases/tag',
group: 'plugins-workspace',
},
];

const baseDir = '../../src/content/docs/release';
Expand All @@ -65,7 +215,7 @@ async function generator() {
})
.filter(({ version }) => !version.includes('Not Published'));

mkdirSync(join(baseDir, pkg.name), { recursive: true });
mkdirSync(join(baseDir, pkg.group || '', pkg.name), { recursive: true });

releases.sort((a, b) => {
return semver.rcompare(a.version, b.version);
Expand Down Expand Up @@ -107,7 +257,7 @@ async function generator() {
//

writeFileSync(
join(baseDir, pkg.name, `v${thisVersion}.mdx`),
join(baseDir, pkg.group || '', pkg.name, `v${thisVersion}.mdx`),
`${frontmatter}\n${linksDiv}\n${entitify(releases[i].notes)}`
);
}
Expand All @@ -129,7 +279,7 @@ async function generator() {
'---',
].join('\n');

const links = [
const mainLinks = [
{ title: 'tauri', key: 'tauri' },
{ title: '@tauri-apps/api', key: '@tauri-apps/api' },
{ title: 'tauri-cli (Rust)', key: 'tauri-cli' },
Expand All @@ -139,6 +289,34 @@ async function generator() {
{ title: 'tao', key: 'tao' },
];

const pluginLinks = [
{ title: 'autostart', key: 'autostart' },
{ title: 'barcode-scanner', key: 'barcode-scanner' },
{ title: 'biometric', key: 'biometric' },
{ title: 'cli', key: 'cli' },
{ title: 'clipboard-manager', key: 'clipboard-manager' },
{ title: 'deep-link', key: 'deep-link' },
{ title: 'dialog', key: 'dialog' },
{ title: 'fs', key: 'fs' },
{ title: 'global-shortcut', key: 'global-shortcut' },
{ title: 'http', key: 'http' },
{ title: 'log', key: 'log' },
{ title: 'nfc', key: 'nfc' },
{ title: 'notification', key: 'notification' },
{ title: 'opener', key: 'opener' },
{ title: 'os', key: 'os' },
{ title: 'positioner', key: 'positioner' },
{ title: 'process', key: 'process' },
{ title: 'shell', key: 'shell' },
{ title: 'sql', key: 'sql' },
{ title: 'store', key: 'store' },
{ title: 'stronghold', key: 'stronghold' },
{ title: 'updater', key: 'updater' },
{ title: 'upload', key: 'upload' },
{ title: 'websocket', key: 'websocket' },
{ title: 'window-state', key: 'window-state' },
];

const generateLinkCards = (links: any[], latestVersions: { [x: string]: any }) => {
return links
.map(
Expand All @@ -159,15 +337,17 @@ import { LinkCard, CardGrid } from '@astrojs/starlight/components';

export const latestVersions = ${JSON.stringify(latestVersions)};

export const links = ${JSON.stringify(links)};
export const mainLinks = ${JSON.stringify(mainLinks)};
export const pluginLinks = ${JSON.stringify(pluginLinks)};

export const LinkCards = () => (
<CardGrid>
${generateLinkCards(links, latestVersions)}
${generateLinkCards(mainLinks, latestVersions)}
</CardGrid>
);

<LinkCards />
## Plugins
<CardGrid>
${generateLinkCards(pluginLinks, latestVersions)}
</CardGrid>
`;

writeFileSync(join(baseDir, 'index.mdx'), `${indexPage}\n${indexPageContent}`);
Expand All @@ -194,8 +374,8 @@ function entitify(str: string): string {
.replace(/\$\{/g, '$\\{');
}

generator();
if (process.env.CONTEXT === 'production' || process.env.HEAD?.startsWith('release-pages')) {
generator();
} else {
console.info('Skipping `/release` pages build');
console.info('Skipping `/release` pages build', process.env.HEAD);
}