Browse Source

chore: embed transifex workflow into CI

tophf 4 years ago
parent
commit
2c0361ec9c
2 changed files with 15 additions and 26 deletions
  1. 15 2
      .github/workflows/ci.yml
  2. 0 24
      .github/workflows/transifex-push-resources.yml

+ 15 - 2
.github/workflows/ci.yml

@@ -16,14 +16,15 @@ jobs:
   ci:
     runs-on: ubuntu-latest
 
-    steps: 
+    steps:
       - name: Checkout code
         uses: actions/checkout@v2
       - uses: actions/setup-node@v2
         with:
           node-version: '15'
 
-      - name: CI
+      - name: Build
+        id: build
         run: yarn && yarn build
 
       - name: Upload Artifact
@@ -33,3 +34,15 @@ jobs:
           path: 'dist/*'
           if-no-files-found: error
           retention-days: 30
+
+      - uses: marceloprado/has-changed-path@v1
+        if: always() && steps.build.outcome == 'success'
+        id: changed-path-src
+        with:
+          paths: src
+
+      - name: Upload to Transifex
+        if: steps.changed-path-src.outputs.changed == 'true'
+        run: 'curl -i -L --user api:$TRANSIFEX_TOKEN -X PUT -F file=@dist/_locales/en/messages.json https://www.transifex.com/api/2/project/violentmonkey-nex/resource/messagesjson/content/'
+        env:
+          TRANSIFEX_TOKEN: ${{ secrets.TRANSIFEX_TOKEN }}

+ 0 - 24
.github/workflows/transifex-push-resources.yml

@@ -1,24 +0,0 @@
-name: Upload resources to Transifex
-
-on:
-  push:
-    branches:
-      - master
-    paths:
-      - src/**
-
-jobs:
-  build:
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout code
-        uses: actions/checkout@v2
-      - uses: actions/setup-node@v2-beta
-        with:
-          node-version: '15'
-      - name: Update locale files
-        run: yarn && yarn copyI18n
-      - name: Upload to Transifex
-        run: 'curl -i -L --user api:$TRANSIFEX_TOKEN -X PUT -F file=@dist/_locales/en/messages.json https://www.transifex.com/api/2/project/violentmonkey-nex/resource/messagesjson/content/'
-        env:
-          TRANSIFEX_TOKEN: ${{ secrets.TRANSIFEX_TOKEN }}