forked from scratchfoundation/scratch-l10n
-
Notifications
You must be signed in to change notification settings - Fork 20
80 lines (67 loc) · 2.68 KB
/
weekly-update-translations.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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 }}