mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 12:45:47 +00:00
99 lines
2.3 KiB
YAML
99 lines
2.3 KiB
YAML
name: Publish translations
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- i18n_v*
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: false
|
|
|
|
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:
|
|
needs: get-translations
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Pages
|
|
uses: actions/configure-pages@v4
|
|
|
|
- name: Prepare output directory
|
|
run: |
|
|
mkdir -p dist/i18n/
|
|
|
|
- name: Download translations
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist/i18n/
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: dist
|
|
|
|
deploy:
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
name: Deploy
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|