mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 12:45:47 +00:00
refactor: add basic versioning to translations
This commit is contained in:
58
.github/workflows/translations.yml
vendored
58
.github/workflows/translations.yml
vendored
@@ -3,7 +3,7 @@ name: Publish translations
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- i18n_v*
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -16,7 +16,53 @@ concurrency:
|
|||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
get-branches:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
i18n-branches: ${{ steps.get-branches.outputs.result }}
|
||||||
|
steps:
|
||||||
|
- name: Get branches
|
||||||
|
id: get-branches
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { data: repos } = await github.rest.repos.listBranches({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
})
|
||||||
|
|
||||||
|
const i18nBranches = repos.filter((branch) => branch.name.startsWith("i18n_v"))
|
||||||
|
const i18nBranchNames = i18nBranches.map((branch) => branch.name)
|
||||||
|
|
||||||
|
return i18nBranchNames
|
||||||
|
|
||||||
|
get-translations:
|
||||||
|
needs: get-branches
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
branch: ${{ fromJson(needs.get-branches.outputs.i18n-branches) }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ matrix.branch }}
|
||||||
|
|
||||||
|
- name: Get translation version
|
||||||
|
id: get-version
|
||||||
|
run: |
|
||||||
|
branch=${{ matrix.branch }}
|
||||||
|
version=${branch#i18n_}
|
||||||
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Upload translations
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ steps.get-version.outputs.version }}
|
||||||
|
path: frontend/src/lib/i18n/locales
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: get-translations
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -25,10 +71,14 @@ jobs:
|
|||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v4
|
uses: actions/configure-pages@v4
|
||||||
|
|
||||||
- name: Move translations
|
- name: Prepare output directory
|
||||||
run: |
|
run: |
|
||||||
mkdir -p dist
|
mkdir -p dist/i18n/
|
||||||
mv frontend/src/lib/i18n/locales dist/i18n
|
|
||||||
|
- name: Download translations
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: dist/i18n/
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ i18n
|
|||||||
],
|
],
|
||||||
backendOptions: [
|
backendOptions: [
|
||||||
{
|
{
|
||||||
loadPath: "https://cdn.tinyauth.app/i18n/{{lng}}.json",
|
loadPath: "https://cdn.tinyauth.app/i18n/v1/{{lng}}.json",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user