Skip to content

Commit

Permalink
Update release table
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvNC committed Jul 12, 2024
1 parent a069bd3 commit 7558adc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/run-upload-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ jobs:
strategy:
matrix:
# Copy from constants.ts
language:
[
language: [
'hu',
'eu',
'pt',
Expand Down Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
};

Expand Down
14 changes: 8 additions & 6 deletions src/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7558adc

Please sign in to comment.