Skip to content

Weekly Update Translations #130

Weekly Update Translations

Weekly Update Translations #130

name: Weekly Update Translations
on:
schedule:
- cron: '0 0 * * 1,4' # Runs at 01:00 UTC on Monday and Thursday
jobs:
weekly-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm ci
- name: Pull translations
run: |
export TX_TOKEN=${{ secrets.TX_TOKEN }}
npm run pull:editor
npm run pull:desktop
npm run pull:linkDesktop
npm run pull:www
npm run test
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)
- name: Commit translations
if: ${{ steps.git-check.outputs.modified == 'true' }}
id: git-push
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git pull
git add .
git commit -m '[skip ci] Pull new editor translations from Transifex'
git remote add origin-translation https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/$GITHUB_REPOSITORY
git push --set-upstream origin-translation main
- name: Get package main version
if: ${{ steps.git-check.outputs.modified == 'true' }}
id: package-version
uses: martinbeentjes/[email protected]
- name: Generate release version
if: ${{ steps.git-check.outputs.modified == 'true' }}
run: |
VPKG=${{ steps.package-version.outputs.current-version }}
echo "RELEASE_VERSION=${VPKG/%?/}$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
- name: Set package version
if: ${{ steps.git-check.outputs.modified == 'true' }}
run: npm --no-git-tag-version version $RELEASE_VERSION
- name: Tag release
if: ${{ steps.git-check.outputs.modified == 'true' }}
run: |
git tag $RELEASE_VERSION
git push https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/$GITHUB_REPOSITORY $RELEASE_VERSION
- uses: JS-DevTools/npm-publish@v1
if: ${{ steps.git-check.outputs.modified == 'true' }}
with:
token: ${{ secrets.NPM_TOKEN }}