From 7558adc8cff62ef07787d92f579f373caa493d58 Mon Sep 17 00:00:00 2001 From: MarvNC Date: Fri, 12 Jul 2024 09:52:02 -0700 Subject: [PATCH] Update release table --- .github/workflows/run-upload-release.yaml | 7 ++----- src/constants.ts | 24 +++++++++++++++++++++++ src/release.ts | 14 +++++++------ 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/run-upload-release.yaml b/.github/workflows/run-upload-release.yaml index 555331a..e2da6ed 100644 --- a/.github/workflows/run-upload-release.yaml +++ b/.github/workflows/run-upload-release.yaml @@ -12,8 +12,7 @@ jobs: strategy: matrix: # Copy from constants.ts - language: - [ + language: [ 'hu', 'eu', 'pt', @@ -83,13 +82,11 @@ jobs: run: bun install --frozen-lockfile - name: Generate Release Table - run: bun run releasetable ${{ github.ref }} + run: bun run releasetable ${{ github.ref_name }} - name: Create Release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ github.ref }} - draft: false prerelease: false generate_release_notes: true diff --git a/src/constants.ts b/src/constants.ts index 0fad892..94e038b 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -36,101 +36,125 @@ export const languageUtils: { [key: string]: { getReading: (definition: string, term: string) => string; fullName: string; + nativeName: string; }; } = { hu: { getReading: (definition, term) => '', fullName: 'Hungarian', + nativeName: 'Magyar', }, eu: { getReading: (definition, term) => '', fullName: 'Basque', + nativeName: 'Euskara', }, pt: { getReading: (definition, term) => '', fullName: 'Portuguese', + nativeName: 'Português', }, ga: { getReading: (definition, term) => '', fullName: 'Irish', + nativeName: 'Gaeilge', }, el: { getReading: (definition, term) => '', fullName: 'Greek', + nativeName: 'Ελληνικά', }, de: { getReading: (definition, term) => '', fullName: 'German', + nativeName: 'Deutsch', }, eo: { getReading: (definition, term) => '', fullName: 'Esperanto', + nativeName: 'Esperanto', }, ar: { getReading: (definition, term) => '', fullName: 'Arabic', + nativeName: 'العربية', }, id: { getReading: (definition, term) => '', fullName: 'Indonesian', + nativeName: 'Bahasa Indonesia', }, pl: { getReading: (definition, term) => '', fullName: 'Polish', + nativeName: 'Polski', }, cs: { getReading: (definition, term) => '', fullName: 'Czech', + nativeName: 'Čeština', }, ca: { getReading: (definition, term) => '', fullName: 'Catalan', + nativeName: 'Català', }, sv: { getReading: (definition, term) => '', fullName: 'Swedish', + nativeName: 'Svenska', }, ru: { getReading: (definition, term) => '', fullName: 'Russian', + nativeName: 'Русский', }, nl: { getReading: (definition, term) => '', fullName: 'Dutch', + nativeName: 'Nederlands', }, uk: { getReading: (definition, term) => '', fullName: 'Ukrainian', + nativeName: 'Українська', }, en: { getReading: (definition, term) => '', fullName: 'English', + nativeName: 'English', }, ko: { getReading: (definition, term) => '', fullName: 'Korean', + nativeName: '한국어', }, es: { getReading: (definition, term) => '', fullName: 'Spanish', + nativeName: 'Español', }, ja: { getReading: (definition, term) => getReadingFromDefinition(definition, term), fullName: 'Japanese', + nativeName: '日本語', }, zh: { getReading: (definition, term) => pinyin(term, { mode: 'surname' }).replace(/ /g, ''), fullName: 'Chinese', + nativeName: '中文', }, fr: { getReading: (definition, term) => '', fullName: 'French', + nativeName: 'Français', }, it: { getReading: (definition, term) => '', fullName: 'Italian', + nativeName: 'Italiano', }, }; diff --git a/src/release.ts b/src/release.ts index f018ee0..d829cd5 100644 --- a/src/release.ts +++ b/src/release.ts @@ -18,14 +18,16 @@ let md = `## Download `; const files = await readdir('./out'); +files.sort((a, b) => { + const langA = languageUtils[a.substring(0, 2).toLowerCase()]; + const langB = languageUtils[b.substring(0, 2).toLowerCase()]; + return langA.fullName.localeCompare(langB.fullName); +}); + for (const file of files) { const lang = languageUtils[file.substring(0, 2).toLowerCase()]; - md += `| ${ - lang.fullName - } | [Download](https://github.com/MarvNC/wikipedia-yomitan/releases/download/${version}/${file.replace( - / /g, - '.' - )}) |\n`; + const fileCleanName = file.replace(/[ \[\]\(\)]+/g, '.').replace(/\.+/g, '.'); + md += `| ${lang.fullName} (${lang.nativeName}) | [Download](https://github.com/MarvNC/wikipedia-yomitan/releases/download/${version}/${fileCleanName}) |\n`; } // Export