Skip to content

Commit

Permalink
feat: add translations workflow for GitHub releases (#47)
Browse files Browse the repository at this point in the history
* feat: switch translations workflow to use GitHub releases

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* fix: seperate deploy and release assets workflows

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* Update .github/workflows/translations-release.yml

Co-authored-by: Seth Falco <seth@falco.fun>

---------

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
Co-authored-by: Seth Falco <seth@falco.fun>
  • Loading branch information
kbdharun and SethFalco authored Mar 3, 2024
1 parent 6c4d8a6 commit 3536d0b
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/translations-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Generate and publish translations to releases

on:
push:
tags:
- '*'
schedule:
# This will run at 00:00 UTC on the first day of every month
- cron: '0 0 1 * *'
workflow_dispatch:

env:
GH_TOKEN: ${{ github.token }}

permissions:
contents: write # to upload assets to releases

jobs:
translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install npm dependencies
run: npm ci

- name: Build
run: npm run build

- name: Fetch sources
run: |
wget https://github.com/tldr-pages/tldr/archive/refs/heads/main.zip --output-document /tmp/main.zip
unzip /tmp/main.zip -d /tmp
- name: Generate CSV dataset
run: |
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-csv --format csv
zip tldr-translations-dataset-csv.zip tldr-translation-pairs-dataset-csv/*
- name: Generate TMX dataset
run: |
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-tmx --format tmx
zip tldr-translations-dataset-tmx.zip tldr-translation-pairs-dataset-tmx/*
- name: Generate JSON dataset
run: |
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-json --format json
zip tldr-translations-dataset-json.zip tldr-translation-pairs-dataset-json/*
- name: Generate XML dataset
run: |
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-xml --format xml
zip tldr-translations-dataset-xml.zip tldr-translation-pairs-dataset-xml/*
- name: Deploy to Release
if: github.repository == 'tldr-pages/tldr-translation-pairs-gen' && github.ref == 'refs/heads/main'
run: |
export RELEASE_TAG="$(git describe --tags --abbrev=0)"
gh release --repo tldr-pages/tldr-translation-pairs-gen upload --clobber "$RELEASE_TAG" -- *.zip

0 comments on commit 3536d0b

Please # to comment.